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

#   Use custom field image like the product image field

##

- **[web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile")**
- [![web-tiki's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/45235-web-tiki "View web-tiki's Profile") Topic Author
- [ Offline](/forum/user/45235-web-tiki)

Less More

- Posts: 20
- Thank you received: 0
-
-

4 years 9 months ago [\#339473](#339473) by [web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile")  *[Use custom field image like the product image field](/forum/26-product-category-display/903979-use-custom-field-image-like-the-product-image-field#339473 "-- HikaShop version -- : 4.4.5 -- Joomla version -- : 4.1 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Firefox  Hi, I need to implement 2 sets of images for product display (in 2 different places). I don't know in advance how many images there will be in each set. For the first set of images, I can use the normal product image field. For the second image set, I investigated the custom field image (AJAX) that allows backend users to upload and delete images. The issue is that I cannot use the images form that field in my template overrides like the normal images. I have custom code that uses  to build urls and create thumbnails for responsive images (using srcset).  The main issue I have is that the images from the custom field are uploaded to the safe folder and it is protected with the .htaccess Is there a way to upload these images to the images&#92;com&#95;hikashop&#92;upload folder instead ? That would allow me to create thumbnails and use them in my template overrides like the normal product image field.  If there is another way to manage multiple sets of images that I overlooked (without custom fields) I would be happy to try. The most user friendly solution would be to duplicate the normal product image field but I have no Idea if it is possible.")* was created by *[web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile")*

-- HikaShop version -- : 4.4.5
-- Joomla version -- : 4.1
-- PHP version -- : 7.4
-- Browser(s) name and version -- : Firefox

Hi,
I need to implement 2 sets of images for product display (in 2 different places). I don't know in advance how many images there will be in each set.
For the first set of images, I can use the normal product image field.
For the second image set, I investigated the custom field image (AJAX) that allows backend users to upload and delete images. The issue is that I cannot use the images form that field in my template overrides like the normal images. I have custom code that uses Code:

$this-&gt;image-&gt;getThumbnail(@$secondaryImage, array('width' =&gt; 2000, 'height' =&gt; 2000), $image_options);

to build urls and create thumbnails for responsive images (using srcset).

The main issue I have is that the images from the custom field are uploaded to the safe folder and it is protected with the .htaccess
Is there a way to upload these images to the images\com_hikashop\upload folder instead ?
That would allow me to create thumbnails and use them in my template overrides like the normal product image field.

If there is another way to manage multiple sets of images that I overlooked (without custom fields) I would be happy to try. The most user friendly solution would be to duplicate the normal product image field but I have no Idea if it is possible.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS85MDM5NzktdXNlLWN1c3RvbS1maWVsZC1pbWFnZS1saWtlLXRoZS1wcm9kdWN0LWltYWdlLWZpZWxkP3RtcGw9bWFya2Rvd24=) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86593
- Thank you received: 14334
-
-

4 years 9 months ago [\#339475](#339475) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Use custom field image like the product image field](/forum/26-product-category-display/903979-use-custom-field-image-like-the-product-image-field#339475 "-- HikaShop version -- : 4.4.5 -- Joomla version -- : 4.1 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Firefox  Hi, I need to implement 2 sets of images for product display (in 2 different places). I don't know in advance how many images there will be in each set. For the first set of images, I can use the normal product image field. For the second image set, I investigated the custom field image (AJAX) that allows backend users to upload and delete images. The issue is that I cannot use the images form that field in my template overrides like the normal images. I have custom code that uses  to build urls and create thumbnails for responsive images (using srcset).  The main issue I have is that the images from the custom field are uploaded to the safe folder and it is protected with the .htaccess Is there a way to upload these images to the images&#92;com&#95;hikashop&#92;upload folder instead ? That would allow me to create thumbnails and use them in my template overrides like the normal product image field.  If there is another way to manage multiple sets of images that I overlooked (without custom fields) I would be happy to try. The most user friendly solution would be to duplicate the normal product image field but I have no Idea if it is possible.")*

Hi,

Supposing that you don't use the "Files" area of the products, what you can do is to force the variables $this-&gt;image-&gt;uploadFolder_url and $this-&gt;image-&gt;uploadFolder to point to the secure folder where you have the htaccess file before calling $this-&gt;image-&gt;getThumbnail for the secondary images, and modify that htaccess file to allow access to it.

Another solution would be to generate the URL of the image yourself like this: Code:

echo hikashop_completeLink('order&amp;task=download&amp;field_table=product&amp;field_namekey='.urlencode(base64_encode('xxx')).'&amp;name='.urlencode(base64_encode($secondaryImage)).'&amp;thumbnail_x=2000&amp;thumbnail_y=2000');

where xxx is the column name of the custom field and $secondaryImage the filename stored in the custom field.
This URL will go through HikaShop to check that the image can be accessed and then sent back to the browser, with resizing if necessary.

The following user(s) said Thank You: [web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile")

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

- **[web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile")**
- [![web-tiki's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/45235-web-tiki "View web-tiki's Profile") Topic Author
- [ Offline](/forum/user/45235-web-tiki)

Less More

- Posts: 20
- Thank you received: 0
-
-

4 years 9 months ago [\#339491](#339491) by [web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile")  Replied by *[web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile")* on topic *[Use custom field image like the product image field](/forum/26-product-category-display/903979-use-custom-field-image-like-the-product-image-field#339491 "-- HikaShop version -- : 4.4.5 -- Joomla version -- : 4.1 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Firefox  Hi, I need to implement 2 sets of images for product display (in 2 different places). I don't know in advance how many images there will be in each set. For the first set of images, I can use the normal product image field. For the second image set, I investigated the custom field image (AJAX) that allows backend users to upload and delete images. The issue is that I cannot use the images form that field in my template overrides like the normal images. I have custom code that uses  to build urls and create thumbnails for responsive images (using srcset).  The main issue I have is that the images from the custom field are uploaded to the safe folder and it is protected with the .htaccess Is there a way to upload these images to the images&#92;com&#95;hikashop&#92;upload folder instead ? That would allow me to create thumbnails and use them in my template overrides like the normal product image field.  If there is another way to manage multiple sets of images that I overlooked (without custom fields) I would be happy to try. The most user friendly solution would be to duplicate the normal product image field but I have no Idea if it is possible.")*

Hi Nicolas,

Thanks for that info, I have managed to test both approaches.
The first one forcing $this-&gt;image-&gt;uploadFolder_url and $this-&gt;image-&gt;uploadFolder seems the best for my use case as it allows me to build all the thumbnails I need (.webp for example) and use the same approach for all images.

I see the thumbnails are generated inside the safe folder. Is there a way to force the thumbnails to be generated in the same folder as "normal images" ?
If not, how should I modify the .htaccess file to allow access to the thumbnail folder. For now I deleted the .haccess file to test.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS85MDM5NzktdXNlLWN1c3RvbS1maWVsZC1pbWFnZS1saWtlLXRoZS1wcm9kdWN0LWltYWdlLWZpZWxkP3RtcGw9bWFya2Rvd24=) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86593
- Thank you received: 14334
-
-

4 years 9 months ago [\#339497](#339497) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Use custom field image like the product image field](/forum/26-product-category-display/903979-use-custom-field-image-like-the-product-image-field#339497 "-- HikaShop version -- : 4.4.5 -- Joomla version -- : 4.1 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Firefox  Hi, I need to implement 2 sets of images for product display (in 2 different places). I don't know in advance how many images there will be in each set. For the first set of images, I can use the normal product image field. For the second image set, I investigated the custom field image (AJAX) that allows backend users to upload and delete images. The issue is that I cannot use the images form that field in my template overrides like the normal images. I have custom code that uses  to build urls and create thumbnails for responsive images (using srcset).  The main issue I have is that the images from the custom field are uploaded to the safe folder and it is protected with the .htaccess Is there a way to upload these images to the images&#92;com&#95;hikashop&#92;upload folder instead ? That would allow me to create thumbnails and use them in my template overrides like the normal product image field.  If there is another way to manage multiple sets of images that I overlooked (without custom fields) I would be happy to try. The most user friendly solution would be to duplicate the normal product image field but I have no Idea if it is possible.")*

Hi,

If you delete the htaccess file, HikaShop will add it back each time you update HikaShop.
So it's not a long term solution.
The best is to edit the htaccess file and change its code. In it, you'll have a line:
deny from all
You want to change it to :
allow from all

The following user(s) said Thank You: [web-tiki](/forum/user/45235-web-tiki "View web-tiki's Profile")

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

- **[Dream](/forum/user/80127-dream "View Dream's Profile")**
- [![Dream's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/80127-dream "View Dream's Profile")
- [ Offline](/forum/user/80127-dream)

Less More

- Posts: 2
- Thank you received: 0
-
-

2 years 10 months ago [\#358216](#358216) by [Dream](/forum/user/80127-dream "View Dream's Profile")  Replied by *[Dream](/forum/user/80127-dream "View Dream's Profile")* on topic *[Use custom field image like the product image field](/forum/26-product-category-display/903979-use-custom-field-image-like-the-product-image-field#358216 "-- HikaShop version -- : 4.4.5 -- Joomla version -- : 4.1 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Firefox  Hi, I need to implement 2 sets of images for product display (in 2 different places). I don't know in advance how many images there will be in each set. For the first set of images, I can use the normal product image field. For the second image set, I investigated the custom field image (AJAX) that allows backend users to upload and delete images. The issue is that I cannot use the images form that field in my template overrides like the normal images. I have custom code that uses  to build urls and create thumbnails for responsive images (using srcset).  The main issue I have is that the images from the custom field are uploaded to the safe folder and it is protected with the .htaccess Is there a way to upload these images to the images&#92;com&#95;hikashop&#92;upload folder instead ? That would allow me to create thumbnails and use them in my template overrides like the normal product image field.  If there is another way to manage multiple sets of images that I overlooked (without custom fields) I would be happy to try. The most user friendly solution would be to duplicate the normal product image field but I have no Idea if it is possible.")*

Hi, may I have the example code with the solution above? Because I tried it, and it shows undefined function for hikashop_completeLink.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS85MDM5NzktdXNlLWN1c3RvbS1maWVsZC1pbWFnZS1saWtlLXRoZS1wcm9kdWN0LWltYWdlLWZpZWxkP3RtcGw9bWFya2Rvd24=) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86593
- Thank you received: 14334
-
-

2 years 10 months ago [\#358255](#358255) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Use custom field image like the product image field](/forum/26-product-category-display/903979-use-custom-field-image-like-the-product-image-field#358255 "-- HikaShop version -- : 4.4.5 -- Joomla version -- : 4.1 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Firefox  Hi, I need to implement 2 sets of images for product display (in 2 different places). I don't know in advance how many images there will be in each set. For the first set of images, I can use the normal product image field. For the second image set, I investigated the custom field image (AJAX) that allows backend users to upload and delete images. The issue is that I cannot use the images form that field in my template overrides like the normal images. I have custom code that uses  to build urls and create thumbnails for responsive images (using srcset).  The main issue I have is that the images from the custom field are uploaded to the safe folder and it is protected with the .htaccess Is there a way to upload these images to the images&#92;com&#95;hikashop&#92;upload folder instead ? That would allow me to create thumbnails and use them in my template overrides like the normal product image field.  If there is another way to manage multiple sets of images that I overlooked (without custom fields) I would be happy to try. The most user friendly solution would be to duplicate the normal product image field but I have no Idea if it is possible.")*

Hi,

That code is fine. If you get an error "undefined function hikashop_completeLink", it means that this code runs somewhere where HikaShop is not loaded.
In that case, you first need to load the HikaShop main helper file: Code:

if(!@include_once(rtrim(JPATH_ADMINISTRATOR,'/').'/components/com_hikashop/helpers/helper.php')){ return false; }

[ www.hikashop.com/support/documentation/6...umentation.html#code](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#code)

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

- **[Dream](/forum/user/80127-dream "View Dream's Profile")**
- [![Dream's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/80127-dream "View Dream's Profile")
- [ Offline](/forum/user/80127-dream)

Less More

- Posts: 2
- Thank you received: 0
-
-

2 years 10 months ago [\#358268](#358268) by [Dream](/forum/user/80127-dream "View Dream's Profile")  Replied by *[Dream](/forum/user/80127-dream "View Dream's Profile")* on topic *[Use custom field image like the product image field](/forum/26-product-category-display/903979-use-custom-field-image-like-the-product-image-field#358268 "-- HikaShop version -- : 4.4.5 -- Joomla version -- : 4.1 -- PHP version -- : 7.4 -- Browser(s) name and version -- : Firefox  Hi, I need to implement 2 sets of images for product display (in 2 different places). I don't know in advance how many images there will be in each set. For the first set of images, I can use the normal product image field. For the second image set, I investigated the custom field image (AJAX) that allows backend users to upload and delete images. The issue is that I cannot use the images form that field in my template overrides like the normal images. I have custom code that uses  to build urls and create thumbnails for responsive images (using srcset).  The main issue I have is that the images from the custom field are uploaded to the safe folder and it is protected with the .htaccess Is there a way to upload these images to the images&#92;com&#95;hikashop&#92;upload folder instead ? That would allow me to create thumbnails and use them in my template overrides like the normal product image field.  If there is another way to manage multiple sets of images that I overlooked (without custom fields) I would be happy to try. The most user friendly solution would be to duplicate the normal product image field but I have no Idea if it is possible.")*

Hi. After load the HikaShop main helper file, the code can works. Thanks a lot.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS85MDM5NzktdXNlLWN1c3RvbS1maWVsZC1pbWFnZS1saWtlLXRoZS1wcm9kdWN0LWltYWdlLWZpZWxkP3RtcGw9bWFya2Rvd24=) 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.061 seconds

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