1

We uploaded product images to our site. Lot of images are in the range of 1600x1200 dimension.

We want to reduce the original size of the product images to 1000x1000.

How to reduce the image dimension so that image file size will decrease respectively?

Can you please explain how to implement in Magento site, in which file, what code do I have to place...?

Please help me to find a solution.

  • 4
    I'm voting to close this question as off-topic because it's not a Magento question. – musicliftsme Mar 2 '15 at 14:30
  • 1
    I'm voting to open as the OP has asked how to implement resizing/cropping into Magento (see my edit) – 7ochem Mar 2 '15 at 20:02
  • See my answer on magento.stackexchange.com/questions/59210/… (You could also care less about height or set a max height with css) – Jeroen Mar 3 '15 at 8:06
2

I told you how to do this the other day yet another question gets opened!

It is best to keep your source images at the higher resolution - they might be useful when everyone has 4K screens. That might not be too far in the future. Therefore the approach I suggested to you last time is pretty good.

If you must resize all your images en-mass, take a look at this answer:

https://stackoverflow.com/questions/10802606/how-to-batch-resize-images-in-ubuntu-recursively-within-the-terminal

Use imagemagick, for which you will need to give 5 minutes to install and read the options available.

2

You could do this using PHP's image manipulation functions.

See http://php.net/manual/en/function.imagecopyresampled.php, the second example there comes close to what you want.

Or you could find some PHP code library that can do this for you.

I would agree with @Mmazvis to do this manually (Photoshop or some other pro tools can batch process this) as PHP image manipulation is a whole different skill.

  • thanks a lot, can you please explain how to implement in magento site, in which file, what code i have to replace..?... – Baby in Magento Mar 2 '15 at 12:28
  • Don't advise the time consuming Photoshop route. Cropping/resizing images either in PHP or at the OS level is not hard. It can all be done on the server without spending all year uploading files. Photoshop is a relative slow-coach doing any batch operations as it has to drive a GUI. The myriad of options are also a tad complicated for the task in hand. – Henry's Cat Mar 2 '15 at 13:57
1

The best practice for using images in magento is to manually crop the image into your desired resolution using photoshop or any other photo editing software such as MS Paint.

I usually make 2 different sizes:

-1000px X 1000px (~80kb)

-300px X 300px (~10kb)

The 1000x1000 image is used as the base image so that it only loads on the product page & the 300x300 image is used for small image & thumbnail.

This practice helps in reducing the load time of the product list view page as many products load at the same time. Bigger images mean more data to be downloaded from server.

Note: Check "Exclude" for the thumbnail(300x300) image

  • This is poor advice. Why waste time resizing images when the server can do it so easily? Manually doing this is not just a waste of time it also means you can make mistakes. – Henry's Cat Mar 2 '15 at 13:54
  • dear @Woolfie , Image Quality is required in E-Commerce and i am sure you are unfamiliar with this concept. When the server resizes the image, it reduces its quality making the image a bit jagged and blurred. Even if somehow the quality isn't effected (which is not possible) the bigger image would yet again load slower from the server because the server would take as much time resizing them. – Tushar Narang Mar 2 '15 at 14:11
  • If you have a directory of images on the server you can resize them in-situ on the server with imagemagick. Downloading them (or re-uploading them) and using some lame desktop graphics app (not sure MS Paint qualifies) means that you have a lot of work to do, which is inefficient, senseless, a total waste of time and exceptionally poor advice to give to someone. You actually don't have to resize anything explicitly if you take the Google PageSpeed route - this does everything on the fly to deliver correct size images to the browser. I tell you this as you might learn something. – Henry's Cat Mar 2 '15 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.