Jump to content

Why does Prestashop not set image sizes to images?


HavanA

Recommended Posts

There are a few topics on this forum regarding image size and the remarks that shop owners get from GTmetrix about the missing image sizes.

 

When I uploaded the images, Prestashop made several copies like thumbnail, small images etc.

 

What is the reason that Prestashop does not automatically add the image size to these copies?

 

 

I seem to have pictures in folders that cannot be found in cpanel via filemanager, e.g. I have a pictures in www.myshop.com/34-home/pictures.jpg --> but the file '34-home' is not present?

Link to comment
Share on other sites

actually, the size is set in your html only if it's available as variable. For example, in the homepage, the homefeatured block has this

 

height="{$homeSize.height}" width="{$homeSize.width}" 

 

Now obviously if the homeSize variable is not set, sizes will be left blank. You can also hardcode them in your theme, if you prefer, so that you solve the issue with gtmetrix

Link to comment
Share on other sites

So it is correct that here in this report of GTMetrix, all these images do not have image dimensions in the html code?

( http://gtmetrix.com/reports/www.inktoutlet.nl/MMmvvVHD ) Or do I misunderstand?

 

I would also like to understand why these images come from files that are not on the server --> if you look at the report you see that images come from ../129-home_default/...etc.  And these images are missing the dimensions. Is there a code missing on my pages or id this supposed to be like this (no image dimensions and these folders like ../129-home_default/.. etc)?

Link to comment
Share on other sites

actually, the size is set in your html only if it's available as variable. For example, in the homepage, the homefeatured block has this

 

height="{$homeSize.height}" width="{$homeSize.width}" 

 

Now obviously if the homeSize variable is not set, sizes will be left blank. You can also hardcode them in your theme, if you prefer, so that you solve the issue with gtmetrix

 

Which .tpl file should I edit for the manufacturers products pages (the pages that show the products for the chosen manufacturers)?

 

Link to comment
Share on other sites

Well, yesterday I looked there but I could not find any code for these images, like e.g. there is in product-list.tpl.

I did look for "<img src=" with missing "height="{$homeSize.height}" width="{$homeSize.width}"  but couldn't find any in that .tpl file?

Link to comment
Share on other sites

Correct, in product-list.tpl on line 40 and 41 the dimensions are specified:

<a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}">
					<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />

So that is why I do not understand it does give the warning on GT metrix? Because in non-manufacturer products lists this warning is not given. And the homeSize.widt is the 124x124, correct?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...