Keyword

[SOLVED] Add an image tag by extra fields

  • Dick Verwey
  • Dick Verwey's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #112965 by Dick Verwey
[SOLVED] Add an image tag by extra fields was created by Dick Verwey
What I want to make is some extra fields for pictures, and for alt tags by the pictures.
I have the following code in my item.php:
Log in  or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 5 months ago - 11 years 5 months ago #112966 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Add an image tag by extra fields
Hello Dick,

I can give you a new approach, one more complex and one much simpler.

You can have two fields, one for the path of the image and one for the alt title.
Both of them have to be text fields and you have to directly output them using their alias.

An example code is here: and here .

This will however result in somehow bloated (but functional and optimal) code.

On the other hand you can strip the elements using the preg_replace or the str_replace function and then output them using the same way mentioned above.

Same code pretty much but you get to use the image uploader and manager in the backend and avoid manually typing paths.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Dick Verwey
  • Dick Verwey's Avatar Topic Author
  • Offline
  • New Member
More
11 years 5 months ago #112967 by Dick Verwey
Replied by Dick Verwey on topic Re: Add an image tag by extra fields
Hello Krikor, thanks for the quick reply!!

I prefer the second method, to avoid typos. I think that could be going wrong with my client.

I am not sure that I understand that method. How should the code look like?
Thats because my php skills aren't that good enough.

Thanks in advance!
Dick

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 5 months ago #112968 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Add an image tag by extra fields
You can use these tutorials here to build your code.

You just need to replace the strings ", />, alt="{regex here{" and the src=" with "" (this pretty much erases them)

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Dick Verwey
  • Dick Verwey's Avatar Topic Author
  • Offline
  • New Member
More
11 years 4 months ago #112969 by Dick Verwey
Replied by Dick Verwey on topic Re: Add an image tag by extra fields
Thanks Krikor, that did the trick for me

Please Log in or Create an account to join the conversation.