HavanA Posted February 20, 2014 Share Posted February 20, 2014 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 More sharing options...
NemoPS Posted February 21, 2014 Share Posted February 21, 2014 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 More sharing options...
HavanA Posted February 21, 2014 Author Share Posted February 21, 2014 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 More sharing options...
NemoPS Posted February 21, 2014 Share Posted February 21, 2014 But this is on the server, I can access it http://www.inktoutlet.nl/presta/129-home_default/pg-510-9ml-origineel-canon-inktcartridge.jpg Yeah, it's code missing on the page Link to comment Share on other sites More sharing options...
HavanA Posted February 21, 2014 Author Share Posted February 21, 2014 Yes, but I cannot see the file via the file manager in cPanel; so that confuses me. And is that supposed to be that dimensions are missing, so shop owners should add them manually? Link to comment Share on other sites More sharing options...
NemoPS Posted February 21, 2014 Share Posted February 21, 2014 ah, because it's rewritten, that is not the real path And yes, if they are missing you have to add them manually to the template Link to comment Share on other sites More sharing options...
HavanA Posted February 21, 2014 Author Share Posted February 21, 2014 ok, thank you for explaining this! Link to comment Share on other sites More sharing options...
HavanA Posted February 21, 2014 Author Share Posted February 21, 2014 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 More sharing options...
NemoPS Posted February 22, 2014 Share Posted February 22, 2014 It should be manufacturer.tpl Link to comment Share on other sites More sharing options...
HavanA Posted February 22, 2014 Author Share Posted February 22, 2014 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 More sharing options...
NemoPS Posted February 24, 2014 Share Posted February 24, 2014 Yes, in the end product-list.tpl is shown on that page too. so that is the file you need to add sizes to! Link to comment Share on other sites More sharing options...
HavanA Posted February 24, 2014 Author Share Posted February 24, 2014 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 More sharing options...
NemoPS Posted February 24, 2014 Share Posted February 24, 2014 It might be that homeSIze (the variable) is not assigned on that page, I can't remember right now so you can even hardcode that if you prefer! And yes 124 is the default one Link to comment Share on other sites More sharing options...
HavanA Posted February 26, 2014 Author Share Posted February 26, 2014 Well, thanks Nemo. I now hardcoded it, and the warning is gone. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now