[Skip to main content](#vessel-content)

#   How to display product image in invoice?

##

- **[grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")**
- [![grayt7's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar30010.jpg)](/forum/user/30010-grayt7 "View grayt7's Profile")
- [ Offline](/forum/user/30010-grayt7)

Less More

- Posts: 376
- Thank you received: 7
-
-
- [](http://www.identitywebdesign.com)
-

4 years 2 months ago [\#343667](#343667) by [grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")  Replied by *[grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")* on topic *[How to display product image in invoice?](/forum/35-orders-management/882497-how-to-display-product-image-in-invoice?start=20#343667 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8  HI, I want to show product image in invoice. What code should I add in the invoice file in Display -&gt; View? Thanks!!")*

Hi,

Yes I can confirm the path to the image is correct and the image is there. If the image is not there the error message is different.

Thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg4MjQ5Ny1ob3ctdG8tZGlzcGxheS1wcm9kdWN0LWltYWdlLWluLWludm9pY2U/c3RhcnQ9MjAmdG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14265
-
-

4 years 2 months ago [\#343668](#343668) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to display product image in invoice?](/forum/35-orders-management/882497-how-to-display-product-image-in-invoice?start=20#343668 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8  HI, I want to show product image in invoice. What code should I add in the invoice file in Display -&gt; View? Thanks!!")*

Hi,

Then how about trying with the URL of the image instead of the relative path ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg4MjQ5Ny1ob3ctdG8tZGlzcGxheS1wcm9kdWN0LWltYWdlLWluLWludm9pY2U/c3RhcnQ9MjAmdG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")**
- [![grayt7's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar30010.jpg)](/forum/user/30010-grayt7 "View grayt7's Profile")
- [ Offline](/forum/user/30010-grayt7)

Less More

- Posts: 376
- Thank you received: 7
-
-
- [](http://www.identitywebdesign.com)
-

4 years 2 months ago [\#343716](#343716) by [grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")  Replied by *[grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")* on topic *[How to display product image in invoice?](/forum/35-orders-management/882497-how-to-display-product-image-in-invoice?start=20#343716 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8  HI, I want to show product image in invoice. What code should I add in the invoice file in Display -&gt; View? Thanks!!")*

Hi,

I'm using the code you pasted here earlier in this thread Code:

&lt;?php $imageHelper = hikashop_get('helper.image'); if(!empty($product-&gt;images[0]-&gt;file_path) &amp;&amp; $config-&gt;get('thumbnail', 1) != 0) { $img = $imageHelper-&gt;getThumbnail($product-&gt;images[0]-&gt;file_path, array(50, 50), array('forcesize' =&gt; true, 'scale' =&gt; 'outside')); if($img-&gt;success) { echo '&lt;img src="'.$img-&gt;url.'" alt="" style="float:left;margin-top:3px;margin-bottom:3px;margin-right:6px;"/&gt;'; } } ?&gt;

I believe that does use the URL of the image - how would I change that to use the relative path?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg4MjQ5Ny1ob3ctdG8tZGlzcGxheS1wcm9kdWN0LWltYWdlLWluLWludm9pY2U/c3RhcnQ9MjAmdG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14265
-
-

4 years 2 months ago [\#343721](#343721) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to display product image in invoice?](/forum/35-orders-management/882497-how-to-display-product-image-in-invoice?start=20#343721 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8  HI, I want to show product image in invoice. What code should I add in the invoice file in Display -&gt; View? Thanks!!")*

Hi,

The variable $img-&gt;url should normally contains something like that:
"/images/com_hikashop/upload/thumbnails/100x100f/myimage.jpg"
That' a relative path. So you already are using a relative path.
What's before the first / is filled by the browser (or the HTML2PDF library in this instance).
So what you can do is prepend the URL of the website so that you force it to use the full URL instead of letting it guess it.
So for example, instead of: Code:

echo '&lt;img src="'.$img-&gt;url.'" alt="" style="float:left;margin-top:3px;margin-bottom:3px;margin-right:6px;"/&gt;';

you could try: Code:

echo '&lt;img src="https://www.mywebsite.com'.$img-&gt;url.'" alt="" style="float:left;margin-top:3px;margin-bottom:3px;margin-right:6px;"/&gt;';

Of course, this is an example. You need to replace [ www.mywebsite.com](http://www.mywebsite.com) by your real website URL.
And that's just what I remember from memory.
The best would be to first directly echo the variable $img-&gt;url to see what's inside so that you can prepend what's needed accordingly.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg4MjQ5Ny1ob3ctdG8tZGlzcGxheS1wcm9kdWN0LWltYWdlLWluLWludm9pY2U/c3RhcnQ9MjAmdG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")**
- [![grayt7's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar30010.jpg)](/forum/user/30010-grayt7 "View grayt7's Profile")
- [ Offline](/forum/user/30010-grayt7)

Less More

- Posts: 376
- Thank you received: 7
-
-
- [](http://www.identitywebdesign.com)
-

4 years 2 months ago [\#343726](#343726) by [grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")  Replied by *[grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")* on topic *[How to display product image in invoice?](/forum/35-orders-management/882497-how-to-display-product-image-in-invoice?start=20#343726 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8  HI, I want to show product image in invoice. What code should I add in the invoice file in Display -&gt; View? Thanks!!")*

HI,

Thanks for the reply.

This produces the same result.

I echo the result to make sure the URL was formed correctly etc but still the same issue?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg4MjQ5Ny1ob3ctdG8tZGlzcGxheS1wcm9kdWN0LWltYWdlLWluLWludm9pY2U/c3RhcnQ9MjAmdG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14265
-
-

4 years 2 months ago [\#343727](#343727) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to display product image in invoice?](/forum/35-orders-management/882497-how-to-display-product-image-in-invoice?start=20#343727 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8  HI, I want to show product image in invoice. What code should I add in the invoice file in Display -&gt; View? Thanks!!")*

Hi,

Can you provide an example of URL that was generated for a thumbnail ?
If you can open it with your browser and see the image, then it means that the URL is correct. In that case, it means there is a problem with the server settings preventing PHP from accessing URLs (most likely with allow_url_fopen : [ www.a2hosting.com/kb/developer-corner/ph...-url-fopen-directive](https://www.a2hosting.com/kb/developer-corner/php/using-php.ini-directives/php-allow-url-fopen-directive) ).
If you can't open the URL with the browser, then there is a problem with the URL itself.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg4MjQ5Ny1ob3ctdG8tZGlzcGxheS1wcm9kdWN0LWltYWdlLWluLWludm9pY2U/c3RhcnQ9MjAmdG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")**
- [![grayt7's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar30010.jpg)](/forum/user/30010-grayt7 "View grayt7's Profile")
- [ Offline](/forum/user/30010-grayt7)

Less More

- Posts: 376
- Thank you received: 7
-
-
- [](http://www.identitywebdesign.com)
-

4 years 2 months ago [\#343729](#343729) by [grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")  Replied by *[grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")* on topic *[How to display product image in invoice?](/forum/35-orders-management/882497-how-to-display-product-image-in-invoice?start=20#343729 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8  HI, I want to show product image in invoice. What code should I add in the invoice file in Display -&gt; View? Thanks!!")*

Hi,

allow_url_fopen is tunred on yes (see attached)  [ ![Screenshot2022-08-05at13-49-58SystemInformation-TotalFootballDirect-Administration.png](/forum/attachment/55344) ](/forum/attachment/55344 "...nistration.png")

Yes you can access the images if you go to the resulting URL, they work fine.

Example URL

[ www.totalfootballdirect.com/images/com\_h...c\_academy\_bundle.png](https://www.totalfootballdirect.com/images/com_hikashop/upload/thumbnails/50x50sO/fitc_academy_bundle.png)

Or tried:

/images/com_hikashop/upload/thumbnails/50x50sO/fitc_academy_bundle.png

Thank you

- [ ![Screenshot2022-08-05at13-49-58SystemInformation-TotalFootballDirect-Administration.png](/forum/attachment/55344) ](/forum/attachment/55344 "...nistration.png") [ ](/forum/attachment/55344?download=1 "...nistration.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg4MjQ5Ny1ob3ctdG8tZGlzcGxheS1wcm9kdWN0LWltYWdlLWluLWludm9pY2U/c3RhcnQ9MjAmdG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14265
-
-

4 years 2 months ago [\#343730](#343730) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to display product image in invoice?](/forum/35-orders-management/882497-how-to-display-product-image-in-invoice?start=20#343730 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8  HI, I want to show product image in invoice. What code should I add in the invoice file in Display -&gt; View? Thanks!!")*

Hi,

As I said, if the URL added in the invoice is correct, then if you get an error about it, it normally means that the HTML2PDF library was not able to get the image. It could be an issue with allow_url_fopen, but it could be something else. For example, a rule in your web server configuration preventing some user-agent from accessing files (to prevent bots from accessing them), or a similar rule in a htaccess file.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg4MjQ5Ny1ob3ctdG8tZGlzcGxheS1wcm9kdWN0LWltYWdlLWluLWludm9pY2U/c3RhcnQ9MjAmdG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")**
- [![grayt7's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar30010.jpg)](/forum/user/30010-grayt7 "View grayt7's Profile")
- [ Offline](/forum/user/30010-grayt7)

Less More

- Posts: 376
- Thank you received: 7
-
-
- [](http://www.identitywebdesign.com)
-

4 years 2 months ago [\#343777](#343777) by [grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")  Replied by *[grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")* on topic *[How to display product image in invoice?](/forum/35-orders-management/882497-how-to-display-product-image-in-invoice?start=20#343777 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8  HI, I want to show product image in invoice. What code should I add in the invoice file in Display -&gt; View? Thanks!!")*

Hi,

I have checked .htaccess, this is not the issue. The hosts ask what "user-agent" could be preventing the access? So they can try to trace the issue.

You can access the image via the URL so not sure why you think its not accessible?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg4MjQ5Ny1ob3ctdG8tZGlzcGxheS1wcm9kdWN0LWltYWdlLWluLWludm9pY2U/c3RhcnQ9MjAmdG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14265
-
-

4 years 2 months ago [\#343780](#343780) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to display product image in invoice?](/forum/35-orders-management/882497-how-to-display-product-image-in-invoice?start=20#343780 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8  HI, I want to show product image in invoice. What code should I add in the invoice file in Display -&gt; View? Thanks!!")*

Hi,

It's quite common to block user agents on web servers :
[ techexpert.tips/apache/apache-blocking-user-agent-access/](https://techexpert.tips/apache/apache-blocking-user-agent-access/)
Most security extensions for Joomla usually have some mechanism to filter user-agents.
There are also security rules for htaccess files to block user-agents for Joomla:
[ gist.github.com/uzielweb/11997372b325d38218b0b28bc90062ea](https://gist.github.com/uzielweb/11997372b325d38218b0b28bc90062ea)
The library used by the plugin to generate the PDF is called TCPDF. It uses file_get_contents to get the data of each image without sepcifying a user-agent. In that case, either PHP will use the user-agent specified in the php.ini or won't send any user-agent:
[ www.php.net/manual/en/context.http.php](https://www.php.net/manual/en/context.http.php)

> Value to send with User-Agent: header. This value will only be used if user-agent is not specified in the header context option above.
>
> By default the user\_agent php.ini setting is used

So I can't say what user-agent is used as it depends on the way your server is setup. What's sure is that it's quite likely different from what a browser sends and could explain why TCPDF is unable to load the image while a browser loads it fine.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg4MjQ5Ny1ob3ctdG8tZGlzcGxheS1wcm9kdWN0LWltYWdlLWluLWludm9pY2U/c3RhcnQ9MjAmdG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")**
- [![grayt7's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar30010.jpg)](/forum/user/30010-grayt7 "View grayt7's Profile")
- [ Offline](/forum/user/30010-grayt7)

Less More

- Posts: 376
- Thank you received: 7
-
-
- [](http://www.identitywebdesign.com)
-

4 years 2 months ago -  4 years 2 months ago [\#343806](#343806) by [grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")  Replied by *[grayt7](/forum/user/30010-grayt7 "View grayt7's Profile")* on topic *[How to display product image in invoice?](/forum/35-orders-management/882497-how-to-display-product-image-in-invoice?start=20#343806 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.8  HI, I want to show product image in invoice. What code should I add in the invoice file in Display -&gt; View? Thanks!!")*

HI Nicolas,

Thanks for the info - I went back to the hosting company which they have replied with:

Thanks for waiting, We've had a look on our side and we cannot see any issues with the server itself. The permissions and ownerships of the files and folders have also been looked at but this doesn't look to be due to the server or platform.

Whats ODD is now it works - so someone did something lol - thanks for your help.

Last edit: 4 years 2 months ago by [grayt7](/forum/user/30010-grayt7 "View grayt7's Profile").

The following user(s) said Thank You: [Philip](/forum/user/34318-philip "View Philip's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL29yZGVycy1tYW5hZ2VtZW50Lzg4MjQ5Ny1ob3ctdG8tZGlzcGxheS1wcm9kdWN0LWltYWdlLWluLWludm9pY2U/c3RhcnQ9MjAmdG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.409 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
