Image auto resize

Ok i need to make it as another thread cause it has a bit deeper problem:

If you follow this thread -- then you’ll get to encounter the same problem. Any image i upload the biggest size it gets is 370 x 370 pixels; This is completely wrong as most of the product images we have prepared so that the user can zoom in and understand the details either light-box it out and see the full img width to understand better(i still can not find in witch way better to do it). And this thread has 2 problems to be solved!

1 -- I figured out why it re-sizes exactly to 36- x 370; Follow this link and you will have the answer. So apparently cause the ZOOM is disabled and i guess it’s cause of the JM Mega Mall template, the Big Image is not created! It uploads-crops and re-sizes to maximum of 370_370. So how do i get the zoom to work or / and also the Big(base image i upload) also to be lay-outed(let’s say i install a light-box extension for that it will still Light-box the small image cause it has no big one!)

2 -- The images are cropped in a very nasty way! See here -- I have thousands of Photo and products to upload. I can not resize-Photoshop each one of the separately cause it will take insane amount of time. Normally in most Joomla extension when i upload a lot of pictures of different sizes they all have the same size of a thumbnail in Category list or grid view. It stretches or crop-centers it but they all look fine. So please help me out. How to make the thumbnails to get all of the same size like here for example?

Thank you very much!

1 answer

Profile photo of Alexandru Gorbenco 240.00 $tone March 31, 2014
Public

YYYYYYyyyyyyyyyyyyyyyyyyyyeeeeeeeeeeeessssssssssss ssssssssssss!!! i did it!!!

After scouting very many forums and different solutions and experimenting myself i found the solution! First of all the base issue for both problem comes from the product list view by the custom settings of Ja MegaMall. Cause it resizes the Other way not the way that Magento.

So in order to upload any image of any size, any height and width, and manage for them to look all of the same size in product list you need to do the following:

in app/design/frontend/fefault/jm_megamall/template/catalog/product/list.phtml find and replace 2 times the follwing codes about first time on line 71 and second time on line 143:

Code:

<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($productgridimagewidth,$productgridimageheight); ?>" width="<?php echo $productgridimagewidth; ?>" height="<?php echo $productgridimageheight; ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

And change it to:

Code:

<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->setQuality(100) ?>" width="170" height="170" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />

This will do it. And all images will be the same and of good quality. Suits my needs perfectly and i guess of many other people. as you will not need to manually edit every Pic apart for thumbnails or use 3rd party extensions or what so ever.

Now also i would advice to replace:

Find this file app/design/frontend/default/jm_megamall/template/catalog/product/view/media.phtml

And replace it with this one app/design/frontend/base/default/tempalte/catalog/product/view/media.phtml

It will bring back the magento default zoom property.

To make it look neat on Jm MegaMall on line73 find the part of the code:

Code:

getFile())->resize(56); ?>" width="56" height="56"

and replace with this one

Code:

getFile())->resize(69); ?>" width="69" height="69"

And the thumbnails will look good as needed for the template.

Now the remain problem is that when you press a thumbnail it will pop-out in a new window and show it’s real size. That is not good especially if people are on tablet or mobile devices so the final edit to make the thumbnail on click-to replace the base image do the following in the media.phtml file

on line find line 73it would start like this:

Code:

<a href="#" onclick="popWin ......

select the entire code you have in all line and replace it with this one:

Code:

<a href="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'image', $_image->getFile()); ?>" title="<?php echo $_product->getName();?>" onclick="$('image').src = this.href; return false;"><img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(69); ?>" width="69" height="69" alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" /></a>

Now everything will work like a charm! i love it

#1

Please login or Register to Submit Answer

Written By

Comments