X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Automatically Generate/ Reduce Photo Size? (https://forum.x-cart.com/showthread.php?t=73872)

FMF 04-21-2016 11:39 AM

Automatically Generate/ Reduce Photo Size?
 
Hi All,

I've just uploaded around 300 product images to my site and have realized that they are way too big (~600kb each).

X-cart automatically generates a new thumbnail for the search and category pages, but for the picture on the product page is still the original file, just reduced dimensions.

Is there any way to bulk reduce the dimensions of the original photo to x dimensions?

I just don't want to have to edit and re upload 300 new photos.

Thanks,
Tyler

qualiteam 04-21-2016 10:10 PM

Re: Automatically Generate/ Reduce Photo Size?
 
Do you have http://www.imagemagick.org/ installed on the server?

If so, you can bulk-resize by calling ImageMagick with the following parameters in the directory with the images on the server:
Code:

mogrify -resize "2880x1800>" *.jpg
, where:
- 2880x1800 - are the desired maximum dimensions
- *.jpg - is the wildcard for the files to be processed by the script

If you don't have SSH access to the server (so you can't run the above command on the server), you can install ImageMagick on your local computer and run the command there (and then upload changed files to the server).

FMF 04-21-2016 10:20 PM

Re: Automatically Generate/ Reduce Photo Size?
 
Thanks for the tip! Yeah, I totally hadn't though about just downloading the files from the /images folder, mass editing them and then reuploading them. That will save a lot of time!

Thanks,
Tyler

cflsystems 04-22-2016 07:38 AM

Re: Automatically Generate/ Reduce Photo Size?
 
This may give you some strange results if you just upload the new images in the /images directory and replace the ones there.
XC saved in database not only the image name and location but size, dimensions, and other info. So if you just replace images the database entries will remain with old info which may not play nice with the new images.

FMF 04-26-2016 04:31 PM

Re: Automatically Generate/ Reduce Photo Size?
 
Quote:

Originally Posted by cflsystems
This may give you some strange results if you just upload the new images in the /images directory and replace the ones there.
XC saved in database not only the image name and location but size, dimensions, and other info. So if you just replace images the database entries will remain with old info which may not play nice with the new images.


Hmm, thanks for the advice Steve. I did notice that my old dimensions still show up on the product edit pages.

As far as I can tell the layout is the same on all browsers though. Is there any easy way to get the database to re-generate those dimensions from the current images?

cflsystems 04-26-2016 05:29 PM

Re: Automatically Generate/ Reduce Photo Size?
 
Maybe this can help - https://www.cflsystems.com/thumbnails-generator-for-x-cart-classic.html

FMF 04-26-2016 05:44 PM

Re: Automatically Generate/ Reduce Photo Size?
 
haha, I actually purchased your thumbnail mod two years ago for another problem.

It didn't actually fix anything since the thumbnails dimensions were already okay and it doesn't seem to modify anything with the original picture dimensions. Not a big deal though as it doesn't seem to be an issue.

cflsystems 04-26-2016 05:46 PM

Re: Automatically Generate/ Reduce Photo Size?
 
The module works with the dimensions set in admin settings so if images fall within these dimensions nothing will be modified of course. The module takes actual image dimensions not the ones written in db.


All times are GMT -8. The time now is 12:37 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.