Keyword

[SOLVED] Get URL of item image

  • Francisco Carvalho
  • Francisco Carvalho's Avatar Topic Author
  • Offline
  • Junior Member
More
10 years 9 months ago - 10 years 8 months ago #122539 by Francisco Carvalho
[SOLVED] Get URL of item image was created by Francisco Carvalho
So, I've did this to get layout:
Log in  or Create an account to join the conversation.

  • olsen
  • olsen's Avatar
  • Offline
  • Elite Member
  • Joomla and K2 Freelancer
More
10 years 9 months ago - 10 years 9 months ago #122540 by olsen
Replied by olsen on topic Re: Get URL of item image
I am not sure where you want to render the image path but i guess if you include this:
<img src="<?php echo $this->item->image; ?>" >

will give you the correct link to the image. If you need to include the href attribute on the img tag try this:
<a href="some link here">
<img src=<?php echo $this->item->image ; ?></img>
</a>

Is this what you want??

Didn't solve your issues?? Why dont you consider hire me? Email me or contact me www.xevedigital.com for details

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

  • Francisco Carvalho
  • Francisco Carvalho's Avatar Topic Author
  • Offline
  • Junior Member
More
10 years 9 months ago #122541 by Francisco Carvalho
Replied by Francisco Carvalho on topic Re: Get URL of item image
Olsen, I already tried that before and it does not render anything.... The $this->item->image; is not a global variable, so I can't access to it in my joomla template index.php (the file where I need to print img)... I actually tried with $jinput, nothing works... Since that k2 item has 4 different images (XS, S, L, XL), I also tried with JURI::base(), but only prints the word "IMAGE" in hash method... So, I am too messy now to think in a best solution... :side:

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

  • olsen
  • olsen's Avatar
  • Offline
  • Elite Member
  • Joomla and K2 Freelancer
More
10 years 9 months ago #122542 by olsen
Replied by olsen on topic Re: Get URL of item image
But where do you want to call the image path? Isnt the K2 template?

Didn't solve your issues?? Why dont you consider hire me? Email me or contact me www.xevedigital.com for details

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

  • Francisco Carvalho
  • Francisco Carvalho's Avatar Topic Author
  • Offline
  • Junior Member
More
10 years 9 months ago #122543 by Francisco Carvalho
Replied by Francisco Carvalho on topic Re: Get URL of item image
Nop, it's in a module with php, to put the image as header.
I already tried to put it in my joomla template, getting Fatal Error in 2 ways. Fatal error: Using $this when not in object context

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 9 months ago #122544 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Get URL of item image
Try using the K2 Content module.

Otherwise you will have to develop a module from scratch, query the DB ... you get the picture.

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

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

  • Francisco Carvalho
  • Francisco Carvalho's Avatar Topic Author
  • Offline
  • Junior Member
More
10 years 9 months ago #122545 by Francisco Carvalho
Replied by Francisco Carvalho on topic Re: Get URL of item image
I already tried to copy variables of mod_k2_content, nothing happened.
I guess that I have less time spended if I just turn $this->Item->image; into a global and them use it in my custom module... or just copy part of mod_k2_content helper.php to get instance. Just a litle blinded right now.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 9 months ago #122546 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Get URL of item image
Try with the default template of K2 content and only return the image.
You can choose a specific item's image as well.

Then you can override that template to fit your needs.

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

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

  • Francisco Carvalho
  • Francisco Carvalho's Avatar Topic Author
  • Offline
  • Junior Member
More
10 years 9 months ago #122547 by Francisco Carvalho
Replied by Francisco Carvalho on topic Re: Get URL of item image
Yes, it's a good way to get that, sweet idea coming from heaven. :) Not what I expected, but will works nicely.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 9 months ago #122548 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Get URL of item image
I 'm glad I could help you :)

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

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