Custom field Ajax image error

  • Posts: 329
  • Thank you received: 18
  • Hikashop Business
3 years 9 months ago #333156

-- HikaShop version -- : 4.4.2
-- PHP version -- : 7.3.27

I have strange error. If I look in to payment log file, I see
Image public_html/images/hikashop/upload/image.jpg could not be opened when trying to generate its thumbnail

This is image for product custom field ajax image type. I can upload the image. Image is visible on site.
But in source code I see strange image path:
/order/download/field_table-product/field_namekey-YXV0b3Jmb3Rv/name-ZGF2aWQtZGVpZGEuanBn/thumbnail_x-190/thumbnail_y-190

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

  • Posts: 83403
  • Thank you received: 13497
  • MODERATOR
3 years 9 months ago #333160

Hi,

This usually means that the image being used as a problem, preventing PHP (GD or Imagick) from opening it.
For example, if you have an image named image.jpg but the image is actually in the PNG format, then GD will try to open it as a JPEG formatted image which will fail and generate the error you see in the log.
Note that browsers are smarter than that and auto detect the format of the file regardless of the extension, so it's possible to properly see the image on the website even though HikaShop cannot generate the thumbnail.

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

  • Posts: 329
  • Thank you received: 18
  • Hikashop Business
3 years 9 months ago #333213

Ok, I will try with some other images. There is lot of those errors, so I hard to believe that all are with wrong extension.
What about strange image path? Can I change it?

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

  • Posts: 83403
  • Thank you received: 13497
  • MODERATOR
3 years 9 months ago #333236

Hi,

Note that the error will appear each time the image is being displayed. So, for each email notification, each order details page, invoice, etc. So the error could happen easily 10 times in the logs for one image alone.

That's the normal URL for an image uploaded in an ajax image custom field. You can't change that.
Files uploaded through custom fields are not stored with other images. They are stored with the "files" in the media/com_hikashop/upload/safe folder. That folder is not accessible to users directly thanks to a htaccess file in it.
This allows HikaShop to check that only people with the correct access can download/open the files in there.
For example, for a custom field of the table "order", where the customer uploads a file during the checkout, you only want him to be able to access his file as well as anyone with a super admin account. Other users won't be able to use the link of the custom field even if they guess it. That's important for the security of the files sent by your customers (when you allow for it).
For a custom product field, that is unnecessary, but it still uses the same mechanism and thus the URL cannot be changed.

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

  • Posts: 329
  • Thank you received: 18
  • Hikashop Business
3 years 9 months ago #333315

Ok, I save image in Gimp as jpg. Error again. There must be something else.

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

  • Posts: 83403
  • Thank you received: 13497
  • MODERATOR
3 years 9 months ago #333319

Hi,

In that case, please provide a backend access, a FTP access and instructions to reproduce the issue via our contact form along with a link to this thread for reference:
www.hikashop.com/support/contact-us.html

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

Time to create page: 0.064 seconds
Powered by Kunena Forum