Custom Field: Ajaz Image Using Wrong Path to Try and Create Thumbnails

  • Posts: 275
  • Thank you received: 25
  • Hikamarket Multivendor Hikashop Business Hikashop Essential
1 week 9 hours ago #368757

-- HikaShop version -- : 6.1.0
-- Joomla version -- : 5.3.3
-- PHP version -- : 8.2.9

When the image tries to generate a thumbnail on the front end, it looks for the original image in the default upload folder for file images/com_hikashop/upload/ instead of the media/com_hikashop/upload/safe/ folder.

Even if we set the custom fields upload folder, it still fails to look in the proper directory according to the safe/logs reports.

It generated "images/com_hikashop/upload/XYZ.jpg could not be opened when trying to generate its thumbnail" (I removed the full path name, but it is logged).

It should be looking in media/com_hikashop/upload/safe/ by default for the Ajaz Image custom field type.

It displays the full-size image instead, which can be problematic/slow for larger images.

Related usability issues include that if the image size limit is set, it allows the upload and displays a green image bar, but no error occurs until after submission. This gives the false impression (especially that green bar) that the images were of good quality. I know they receive an upload file that is larger than the maximum upload size after they submit, but it sends a confusing message, especially on mobile. Even added helper text, but people are still getting frustrated. Ideally, there should be a check before upload with Ajax and display an error message similar to the file type error, and at the very least, not a green bar, as it gives the wrong impression.

Last edit: 1 week 8 hours ago by jazzmang. Reason: Adding a note about the file size issue on the same field type.

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

  • Posts: 84496
  • Thank you received: 13738
  • MODERATOR
6 days 16 hours ago #368758

Hi,

Could you provide a screenshot of the settings of the custom field ?

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

  • Posts: 275
  • Thank you received: 25
  • Hikamarket Multivendor Hikashop Business Hikashop Essential
6 days 4 hours ago #368793

Nothing fancy other than the condition to show only when another field is checked.

I tried with and without the Upload folder set.

I also tried without the Allowed files, Thumbnails dimensions, and Delete files not set.

Attachments:

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

  • Posts: 84496
  • Thank you received: 13738
  • MODERATOR
5 days 10 hours ago #368826

Hi,

Thanks. I was able to reproduce the issue and made a patch for it. I've also made modifications to better support the dark mode, and handle the file size check also before the upload.
You can download the install package of HikaShop on our website and install it on your website to get all the modifications. This will require clearing the cache of your browser.

The following user(s) said Thank You: jazzmang

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

  • Posts: 275
  • Thank you received: 25
  • Hikamarket Multivendor Hikashop Business Hikashop Essential
5 days 9 hours ago #368827

I installed the new version. The file size limit warning works great, thanks.

As for the thumbnail, I no longer receive an error in the log.

However, on the front-end registration, where we are using this field, it displays the full-size image as the thumbnail image after upload.

The image loads with progressive scan, so I can tell it is an original full-size image of several MB. If you examine the image properties in the browser debugger, you will see that the original image dimensions are 2000x2000, not the 100x100 set in the custom field's settings.

On the backend in the Customers view, it appears to display correctly and uses a property-sized, generated thumbnail image.

Not sure if that is intentional or a bug on the front end.

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

  • Posts: 84496
  • Thank you received: 13738
  • MODERATOR
5 days 4 hours ago #368828

Hi,

Ok. I see what the problem is. It's because of the SEF. I've made another patch to take into account the parameters of the thumbnail size in the URL of the image properly.
You can download the install package of HikaShop on our website and install it on your website to get this modification too.

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

  • Posts: 275
  • Thank you received: 25
  • Hikamarket Multivendor Hikashop Business Hikashop Essential
5 days 3 hours ago #368836

When I updated, I saw in the HikaShop backend area:
Joomla\CMS\Filesystem\Folder::folders: Path is not a folder. Path: [ROOT]/administrator/components/com_hikashop/extensions

I created the directory, but it disappeared; however, no thumbnail appeared upon upload on the front end.

I rolled back to the previous version, then uploaded the new package again, and it is working as intended on the second attempt.

However, the extensions folder was removed, and I got the error again:
Joomla\CMS\Filesystem\Folder::folders: Path is not a folder. Path: [ROOT]/administrator/components/com_hikashop/extensions

I recreated the folder, and the error disappeared.

I'm not sure why the administrator/components/com_hikashop/extensions directory is being deleted during this update.

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

  • Posts: 84496
  • Thank you received: 13738
  • MODERATOR
4 days 15 hours ago #368837

That folder is where the install files for the plugins and modules included in HikaShop are extracted by Joomla. Then, these files are copied to their destination during the install / update process and then the installer deletes the folder as it is not needed after the installation process.
That error indicates that for some reason the folder was missing before the install process could move the files to their destination.
That should normally not happen and it is not linked to what we were talking here so far or the modifications I made.
I dont see how you could have that error on the HikaShop backend. This code only runs during the install / update process.
I think you can ignore it.

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

  • Posts: 275
  • Thank you received: 25
  • Hikamarket Multivendor Hikashop Business Hikashop Essential
3 days 8 hours ago #368873

I think you missed that when I updated, the folder already existed and was deleted.

It deletes the existing folder any time I upload that new version.
I can recreate the folder and re-upload it, but it would just be deleted again and display the same message.

I just recreated the folder to make the warning disappear.
Not sure there was anything in the folder to begin with (certainly isn't now).

FYI, for anyone else, turning off page caching (Joomla or otherwise) on the HikaShop user registration menu form when using the Ajax Image field can cause issues.

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

  • Posts: 84496
  • Thank you received: 13738
  • MODERATOR
2 days 13 hours ago #368886

I think I understand. It's probably an access right issue with the hikashop folder.
I've added a patch on our end which should help for this so that the warning doesn't show up.

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

Time to create page: 0.073 seconds
Powered by Kunena Forum