- Posts: 22
COMMUNITY FORUM
[SOLVED] Get URL of item image
- Francisco Carvalho
-
Topic Author
- Offline
- Junior Member
Less
More
11 years 5 months ago - 11 years 4 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
-
- Offline
- Elite Member
- Joomla and K2 Freelancer
11 years 5 months ago - 11 years 5 months ago #122540
by olsen
Didn't solve your issues?? Why dont you consider hire me? Email me or contact me www.xevedigital.com for details
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:
will give you the correct link to the image. If you need to include the href attribute on the img tag try this:
Is this what you want??
<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
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
11 years 5 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
-
- Offline
- Elite Member
- Joomla and K2 Freelancer
11 years 5 months ago #122542
by olsen
Didn't solve your issues?? Why dont you consider hire me? Email me or contact me www.xevedigital.com for details
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
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
11 years 5 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
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
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
11 years 5 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.
Otherwise you will have to develop a module from scratch, query the DB ... you get the picture.
Please Log in or Create an account to join the conversation.
- Francisco Carvalho
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
11 years 5 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.
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
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
11 years 5 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.
You can choose a specific item's image as well.
Then you can override that template to fit your needs.
Please Log in or Create an account to join the conversation.
- Francisco Carvalho
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
11 years 5 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
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
11 years 5 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 :)
Please Log in or Create an account to join the conversation.
- Francisco Carvalho
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
11 years 5 months ago #122549
by Francisco Carvalho
Replied by Francisco Carvalho on topic Re: Get URL of item image
After trying this way, I assume a problem: my need is to get current item image (not only show them in article like custom blogs and put it in a header). So, I really need a way to get access to variable $this->item->image.
Any idea for how could this be done? k2 content module shows ALL items (not only the current).
Any idea for how could this be done? k2 content module shows ALL items (not only the current).
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
11 years 4 months ago #122550
by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Get URL of item image
Ok. then you need a K2 plugin (It will still render in the component area but it closer to what you need).
This will get you started getk2.org/extend/extensions/90-example-k2-plugin-for-developers
This will get you started getk2.org/extend/extensions/90-example-k2-plugin-for-developers
Please Log in or Create an account to join the conversation.
- Francisco Carvalho
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
11 years 4 months ago #122551
by Francisco Carvalho
Replied by Francisco Carvalho on topic Re: Get URL of item image
Ok, new sweet idea: set a SESSION to get $this variable. Works as '1'+'1'=11 (actually need to figure out how could this sum equals 11) :P
Firstly need to set cookie in item.php template view.
Something like:
Firstly need to set cookie in item.php template view.
Something like:
Log in or Create an account to join the conversation.