Convert product images

  • Posts: 80
  • Thank you received: 8
9 years 10 months ago #185419

-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.5
-- Browser(s) name and version -- : Chrome
-- Error-message(debug-mod must be tuned on) -- : No error

Hi,

My customer has by mistake created a lot of product images as PNG files. You will understand what this means for the resulting size of the website so I would convert these files to JPG.

I came to the following actionplan;

1. Create a full backup of the site.
2. Copy all PNG images from ‘public_html/media/com_hikashop/upload’ to local PC.
3. Convert (in a batch) all PNG files to JPG files.
4. Copy the JPG files to ‘public_html/media/com_hikashop/upload’
5. In the databasetable #__hikashop-file, in the column file_name change every file extension PNG to JPG after checking if the filename has been converted in step 3.
6. Check in the site frontend if all images are shown.
7. From the folder ‘public_html/media/com_hikashop/upload’ remove all files with the PNG extension.
8. From the folder ‘public_html/media/com_hikashop/upload’ remove all folders with ‘thumbnail’ in the name. (As far as I found, these are all created automagicaly when used;)
9. Again, verify in the frontend if all images are shown.
10. Create a full backup of the site.

I would appriciate if you could verify the planned actions and correct me where I am wrong.

Regards,

Benny.

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

  • Posts: 193
  • Thank you received: 76
9 years 10 months ago #185442

5. Wrong. Column name is file_path (file name in upload folder) not file_name(alt attribute for <img> tag).
There are several ways to update all files extensions in this table:
- SQL UPDATE command
- backup table, open backup file in editor, search-replace .png->.jpg, save, import it back. Make sure that your editor handle UTF-8 encoding correctly.
- Export products to csv file, open it in Excel, replace extensions in column images, import it back using Mass action. You can also use Import CSV interface, but it will change product_created date for all products to current date.

6. Delete all thumbnails, then browse all products in administration. If image is missing, Hikashop will display warning. This works only for first image. If your products have more images, you can't rely on this. If you know PHP or Javascript, it will be trivial to write simple script to verify no image is missing/redundant.

The following user(s) said Thank You: bp54

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

  • Posts: 80
  • Thank you received: 8
9 years 10 months ago #185453

Thank you so much Korzo for checking the actionplan and your advise.
Regards, Benny.

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

Time to create page: 0.066 seconds
Powered by Kunena Forum