Reputation: 35
my server getting too slow due magento's resize image. i am using following code for display image
echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(250,250)
This is load actual image (if i upload havy image like 2mb,3mb ) if i am not using resize function but if i use this function then its always resize it to 250x250 that makes server extra work of resizing image which can be done once at uploading image i just want to avoid this resize process so every time image will not resize it should be resized when we uploading in magento when create a product. please give me solution
Upvotes: 3
Views: 3238
Reputation: 4141
just skip the resizing. Everything is done in __toString()
so if you remove the resize() there is no resizing and the file is only copied to the cache.
EDIT It is important that you have the right small image uploaded in the backend. You can upload multiple images. And set three (in standard installation image, small_image and thumbnail) in the backend. These images can be access via
$this->helper('catalog/image')->init($_product, 'IMAGE_TYPE')
So if you upload a 250x250px image, mark it as thumbnail then you can remove the resize and everything works fine.
What you can do - but don't ask me how - is to put the resized images into the cache. But there are a lot of problems, after inserting them, e.g. flush the image cache -> all images are deleted
Upvotes: 1