Jump to content

Product images not showing in IE after update to 1.5.3.1


Recommended Posts

Hello,

 

after upgrading my shop from 1.5.2 to 1.5.3.1 everything seems fine on Chrome and Firefox, but product images in home featured and product templates don't show on Internet Explorer.

 

Looking at the source seems like the width and height attributes are empty. I've checked the tpl smarty files from the default theme and mine, and both are ok. For example:

 

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" />

 

Translates to:

 

<img src="http://shop.com/image.url" height="" width="" alt="Product Name" >

 

Thanks in advance.

Edited by awesomo (see edit history)
Link to comment
Share on other sites

Hello,

 

after upgrading my shop from 1.5.2 to 1.5.3.1 everything seems fine on Chrome and Firefox, but product images in home featured and product templates don't show on Internet Explorer.

 

Looking at the source seems like the width and height attributes are empty. I've checked the tpl smarty files from the default theme and mine, and both are ok. For example:

 

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" />

 

Translates to:

 

<img src="http://shop.com/image.url" height="" width="" alt="Product Name" >

 

Thanks in advance.

 

 

The problem if you are using the images in the template with '_default'

 

In the file classes/ImageType.php change:

 

public static function getFormatedName($name)
{
	   $theme_name = Context::getContext()->shop->theme_name;			
	   $name_without_theme_name = str_replace(array('_'.$theme_name, $theme_name.'_'), '', $name);

 

by:

 

public static function getFormatedName($name)
{
	   $theme_name = Context::getContext()->shop->theme_name;			
          $theme_name ='default';           
	   $name_without_theme_name = str_replace(array('_'.$theme_name, $theme_name.'_'), '', $name);

 

Hope this helps

Edited by raulpopi (see edit history)
  • Like 5
Link to comment
Share on other sites

Thank you, it worked well.

 

However I didn't have any problems before on the previous version and I don't like very much to change the core files. Is there a way to fix that without editing clasees/ImageType.php?

 

 

Only fails in version 1.5.3.1.

 

To operate without touching code in images such that (small_default, medium_default, large_default, ...). Should be created (small, medium, large, ...) without the _default.

Then in the theme files should appear small, medium, large, without the _default.

 

The _default on images relates to the topic, you can substitute the name of your theme, both in theme files, as in preference-> images

Link to comment
Share on other sites

Thank you, it worked well. However I didn't have any problems before on the previous version and I don't like very much to change the core files. Is there a way to fix that without editing clasees/ImageType.php?

 

Hi.

 

I have the same problème after upgrade to 1.5.3.1.

 

I don't uderstant the 2nd soluce of raulpopi (i have picture with and witouht _default) and the don't display with IE.

 

So the solution i found, is to change your template name.

For exemple :

  • change default to defaultPS
  • change your template name to default

This without changing template folder name of course.

  • Like 1
Link to comment
Share on other sites

I have done this change:

  • change default to defaultPS
  • change your template name to default

but explorer still doesn't shoy images. Do you know what is wrong?

 

 

The problem:

 

If the template's product-list.tpl:

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}"

 

Prestashop verifies that the name of the image bearing the name of the theme: _default, or your name theme.

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_yournametheme')}"

 

Also supports a name without _ for all theme.

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}"

 

 

As long as the images are created with that name in the back office.

home_yournametheme

home

home_default

in each case

  • Like 1
Link to comment
Share on other sites

As long as the images are created with that name in the back office.

home_yournametheme

home

home_default

in each case

 

I don't understand this part. Can you explain it?

I changed the products-list.tpl this line:

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_yournametheme')}"

 

but doesnt work either.

Link to comment
Share on other sites

As long as the images are created with that name in the back office.

home_yournametheme

home

home_default

in each case

 

I don't understand this part. Can you explain it?

I changed the products-list.tpl this line:

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_yournametheme')}"

 

but doesnt work either.

 

In the back office in the menu: prefencias-> images, you will have a list of images, with your name and size.

example:

 

 

1 small_default 45 px 45 px

2 medium_default 58 px 58 px

3 large_default 300 px 300 px

4 thickbox_default 600 px 600 px

5 category_default 745 px 150 px

6 home_default 124 px 124 px

...........

...........

 

You should create your own theme for. If your theme folder called mytheme:

 

 

11 small_mytheme 45 px 45 px

12 medium_mytheme 58 px 58 px

13 large_mytheme 300 px 300 px

14 thickbox_mytheme 600 px 600 px

15 category_mytheme 745 px 150 px

16 home_mytheme 124 px 124 px

...........

...........

 

And in code: <img src="{$link->getImageLink($product.link_rewrite, $product.d_image, 'home_mytheme)}"

Edited by raulpopi (see edit history)
  • Like 1
Link to comment
Share on other sites

I forgot to write that it only worked if I changed the width and height in this line in product-list.tpl:

 

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="120" height="120"{/if} />

  • Like 2
Link to comment
Share on other sites

I forgot to write that it only worked if I changed the width and height in this line in product-list.tpl:

 

<img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="120" height="120"{/if} />

 

If it works: {if isset($homeSize)} -> Then it has value.

 

{$homeSize.height}, {$homeSize.width} -> What value does?

Link to comment
Share on other sites

  • 2 weeks later...

I also have the same problem... :-( Have updated to version 1.5.3.1 & since then there are no pics on my HOME page when I use Internet Explorer... But when I use firefox everything work 100%. I am not very cluedup on programing & stuff. Are there a easy way to fix the problem? :-)

 

Hope to hear from someone soon! :-)

 

Henlo

South Africa

Link to comment
Share on other sites

Where to delete the image -

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

 

From which file name.

 

Do reply.

 

Thanks

 

just deleted

 

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

 

and image appear

 

Please Help me out.. My image is not display. Check my site : http://eshoppy.org and it is new version 1.5.3.1

But at my site : http://baazee.org, image display fine and it is version 1.4.9

 

What is the problem with this new version.

 

Please Guide me.

 

Thanks

Please Help me out.. My image is not display. Check my site : http://eshoppy.org and it is new version 1.5.3.1

But at my site : http://baazee.org, image display fine and it is version 1.4.9

 

What is the problem with this new version.

 

Please Guide me.

 

Thanks

 

Any one , please resolve this problem.. Thanks

Link to comment
Share on other sites

Where to delete the image -

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

 

From which file name.

 

Do reply.

 

Thanks

 

 

 

 

 

 

Any one , please resolve this problem.. Thanks

 

any module/filename u using like, product-list.tpl, homefutured module

 

cause this is bug for IE, IE read height and width 0

Link to comment
Share on other sites

I have a somewhat similar problem and tried renaming image preferences without the _default (so small_default) became small and so on. i tried few other things people mentioned in the threads but nothing seems to be working. My issue and I'm a newbie to all of this, is that most of the images are not showing up. Some of the them are showing up, which is very strange. Does anyone know what to do here? for instance this one work http://www.goldthimb...troller=product

but this and many others dont - http://www.goldthimblefabric.com/index.php?id_product=28&controller=product

 

it seems very strange. i tried regenerating everything, renaming, moving images (as well we checking No option in using legacy image system).. nothing seems to be working.. only a handful of products i originally created show up all others come up with strange error messages and when you click on non-working image, there is also something wrong... any help would be greatly appreciated...

Edited by goldthimble (see edit history)
Link to comment
Share on other sites

2nd link was incorrect i updated it.. i found the issue.. files are named incorrectly in image folders since i named them without _default.. so its pointing to the wrong thing.. older products still have that _default so they are working.. is there a way to change the setting without manually renaming each picture?

Edited by goldthimble (see edit history)
Link to comment
Share on other sites

Beware of renaming the default images - that stopped me from uploading new images (well the images uploaded but would not show in front or back office)

 

So I created new images types and left the old ones as they were

 

e.g

I now have

small_default

AND

small_NEWTHME

 

Also the name of the new theme needs to be less than 16 characters (e.e NEWTHEME < 16 characters)

 

So if your theme name is more than 16 characters

 

Step by step:

1 Go to the themes folder using ftp and change the folder name to less than 16 characters

2 Go to admin/Preferences/themes and select the new theme

Link to comment
Share on other sites

I did experience the same problem and found a workaround which will not need to change core files. With chrome of firefox it looks ok but in IE there are no images. The problem is that width="" and height="" will result in width="1" and height="1" in IE. So you cannot see the image (I found out by pressing F12 in IE).

 

But in chrome+firefox it does also not have height and widt, however those show the original image size as if no height or width was set.

 

From this valuable topic I learned that it's related the the name of the image type. In my 1.5.3 it indeed shows all types with _default. For example home_default. No if you have a template called 'test'. The suddenly in Image::getSize() it tries to find the type test_home (so not even home_test). And that type doesn't exist so prestashop returns empty values!

 

To change this without changing core files I have a little override function. Open override/classes/imageType.php and add the function like this:

 

 

<?php

class ImageType extends ImageTypeCore
{
 public static function getFormatedName($name) {

$formatedName=parent::getFormatedName($name);
if(!self::getByNameNType($formatedName)) {
  $formatedName=$name.'_default';
}
return $formatedName;
 }
}

 

This will use first the orginal getFormatedName() and if it returns a non existing type (like test_home) then it will set it to the _default version (so in the example home_default).

 

This way you don't need to change core files and will only correct in case it's wrong.

 

Regards, Bob

Edited by shopimport.nl (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Well what a bother this image thing has been. I have resolved it so all works but not happy at having to make so many changes.

I did the move images, then

 

I changed my images to my theme name and that worked for IE and other browsers but not for any new images I then loaded.

 

I have to go into product_list tpl and Product Template in my them and find the img references and add my them to the end. Then I had to regenerate product images and yes I have all images. It should not be this hard. Especially when one is not that code confident.

Link to comment
Share on other sites

www.petseverywear.co.nz

 

I have fixed some by adjust product list and regenerating but if you look at the new product images on the home page you will see what I mean.

 

If you go to cat collars and select the first product you will sell the color pick boxes are all fuzzy too. I can not see which image this works from.

 

Or if I upgrade to 1.5.4 will it address this??

Link to comment
Share on other sites

now worse than ever. Due to the large amount of images the regeneration did not go well. I am unsure which ones work so an doing product types one by one but not going well at all.

The image you had was good in the product list but the small defaults are bad and the color picker boxes still a mess.

Link to comment
Share on other sites

Thanks Shacker

I hope this issue is resolved in 1.5.4 as this has been such a pain.

I have picture restored except for the color picker boxes- the images still overflow the boxes. For the life of me I can not work out what controller this and why it went haywire. Any guidance welcome.

 

I am unsure what will happen when I load new images but will have to call it a night. Good Friday tomorrow. Happy Easter

Link to comment
Share on other sites

It is better than it was.

Moved images in preference and then indivdually did regeneration. However I do now have 2 image types in folder. home, home_default, Home_mytheme. Still have my them in product-list template.

 

Not perfect still working on some issues but better than it was.

www.petseverywear.co.nz

Link to comment
Share on other sites

The problem if you are using the images in the template with '_default'

 

In the file classes/ImageType.php change:

 

public static function getFormatedName($name)
{
	   $theme_name = Context::getContext()->shop->theme_name;			
	   $name_without_theme_name = str_replace(array('_'.$theme_name, $theme_name.'_'), '', $name);

 

by:

 

public static function getFormatedName($name)
{
	   $theme_name = Context::getContext()->shop->theme_name;			
	   $theme_name ='default';		  
	   $name_without_theme_name = str_replace(array('_'.$theme_name, $theme_name.'_'), '', $name);

 

Hope this helps

i work perfect
Link to comment
Share on other sites

  • 1 month later...

The problem if you are using the images in the template with '_default'

 

In the file classes/ImageType.php change:

 

public static function getFormatedName($name)
{
	   $theme_name = Context::getContext()->shop->theme_name;			
	   $name_without_theme_name = str_replace(array('_'.$theme_name, $theme_name.'_'), '', $name);

 

by:

 

public static function getFormatedName($name)
{
	   $theme_name = Context::getContext()->shop->theme_name;			
	   $theme_name ='default';		  
	   $name_without_theme_name = str_replace(array('_'.$theme_name, $theme_name.'_'), '', $name);

 

Hope this helps

 

This solution did not work for me :(

Im using 1.5.3.1 version. I have never updated my prestashop

Edited by arash_a2k (see edit history)
Link to comment
Share on other sites

This solution did not work for me :(

Im using 1.5.3.1 version. I have never updated my prestashop

 

In Images -> Preferences, you'll see a list of your images, for example:

small_default, medium_default, large_default.

or

small_yourname, medium_yourname, large_yourname.

 

 

In the code of public static function getFormatedName($name), you have to replace:

$theme_name = 'default';

by

$theme_name = 'yourname';

  • Like 1
Link to comment
Share on other sites

In Images -> Preferences, you'll see a list of your images, for example:

small_default, medium_default, large_default.

or

small_yourname, medium_yourname, large_yourname.

 

 

In the code of public static function getFormatedName($name), you have to replace:

$theme_name = 'default';

by

$theme_name = 'yourname';

 

Thanks I did what you said before and I get the second step from someone else, now it works :)

 

solution:

1-0): put this code

 

$theme_name ='default';

 

in line between these two lines in public static function getFormatedName( ...) in ImageType.php in classes/ImageType.php

 

$theme_name = Context::getContext()->shop->theme_name;

 

"here should be that code "

 

$name_without_theme_name = str_replace(array('_'.$theme_name, $theme_name.'_'), '', $name);

 

1-1). go to homefeatured2.php

 

in hookDsiplayHome(..)

change 'homeSize' => Image::getSize('home'),

 

to 'homeSize' => Image::getSize('home_default'),

 

 

 

" for avoiding any more misguidings: my problem was that in IE the product images from homefeatured 2 were not displaying at all : 0 X 0 pix )

Edited by arash_a2k (see edit history)
Link to comment
Share on other sites

Hi,

 

Having the same problem. I am using Prestashop 1.5.4 and theme Alysum and pictures in ie are not displaying correctly. They are stretched out. I have tried to do as recommended here but I cannot get it right.

 

In the preferences folder I am using images small_asylum, large_asylum.

 

So, I tried adding the line:

public static function getFormatedName($name)

{

$theme_name = Context::getContext()->shop->theme_name;

$theme_name ='asylum';

$name_without_theme_name = str_replace(array('_'.$theme_name, $theme_name.'_'), '', $name);

 

But it did not fix this.

 

I also amended homefeatured.php (i do not have homefeatured2.php) without success. The original file looks like the following:

'homeSize' => Image::getSize(ImageType::getFormatedName('default'))

 

The product list tpl file is the following:

img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_alysum')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />

 

Any ideas?

Link to comment
Share on other sites

Hi,

 

Having the same problem. I am using Prestashop 1.5.4 and theme Alysum and pictures in ie are not displaying correctly. They are stretched out. I have tried to do as recommended here but I cannot get it right.

 

In the preferences folder I am using images small_asylum, large_asylum.

 

So, I tried adding the line:

public static function getFormatedName($name)

{

$theme_name = Context::getContext()->shop->theme_name;

$theme_name ='asylum';

$name_without_theme_name = str_replace(array('_'.$theme_name, $theme_name.'_'), '', $name);

 

But it did not fix this.

 

I also amended homefeatured.php (i do not have homefeatured2.php) without success. The original file looks like the following:

'homeSize' => Image::getSize(ImageType::getFormatedName('default'))

 

The product list tpl file is the following:

img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_alysum')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />

 

Any ideas?

 

 

ohhh i am realy sorry fella . I made a mistake, my comment was misguiding you !

I changed homefeatured2 because it is a module that I used instead of homefeutured to show my products in homepage of my shop, this module did not display images on Internet Explorer,

so, I changed some code in it.

Thus, at first please restore your homefeatured code, and let it to be the way it was.

 

I have a suggestion to you, but I do not know if it works, follow these steps:

first of all backup any file that you want to change ( .tpl, .css, .php )

then go to your back office in the preference/images change your image names to their original names

I mean changed them to small_default large_default and.....

 

Then go to ImageType.php in classes/ImageType.php and put this code :

 

$theme_name ='default';

 

in line between these two lines in public static function getFormatedName( ...) in ImageType.php in classes/ImageType.php

 

$theme_name = Context::getContext()->shop->theme_name;

 

"here should be that code "

 

$name_without_theme_name = str_replace(array('_'.$theme_name, $theme_name.'_'), '', $name);

 

there is a second step but it depends that in which module or where at your page the images are shown streched?

my problem was different from yours

if the images that is shown streched are from a module you can find function like this in the php codes of your module

Image::getSize('home'),

and changed it to

'homeSize' => Image::getSize('home_default'),

Edited by arash_a2k (see edit history)
  • Like 1
Link to comment
Share on other sites

Hi,

 

Many thanks, I have done as you said. For step 2, the stretched images are from the product category page where there is the grid list of all products in that categoru. And in the product page, the picture has correct size but the box of the picture is of a wrong size. This is also true for the product carousel module. The picture itself is correct, but the background box is not correct.

Link to comment
Share on other sites

Hi,

 

Many thanks, I have done as you said. For step 2, the stretched images are from the product category page where there is the grid list of all products in that categoru. And in the product page, the picture has correct size but the box of the picture is of a wrong size. This is also true for the product carousel module. The picture itself is correct, but the background box is not correct.

 

you are welcome my friend, So did you solve these issues?

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
  • 1 month later...

ohhh i am realy sorry fella . I made a mistake, my comment was misguiding you !

I changed homefeatured2 because it is a module that I used instead of homefeutured to show my products in homepage of my shop, this module did not display images on Internet Explorer,

so, I changed some code in it.

Thus, at first please restore your homefeatured code, and let it to be the way it was.

 

I have a suggestion to you, but I do not know if it works, follow these steps:

first of all backup any file that you want to change ( .tpl, .css, .php )

then go to your back office in the preference/images change your image names to their original names

I mean changed them to small_default large_default and.....

 

Then go to ImageType.php in classes/ImageType.php and put this code :

 

$theme_name ='default';

 

in line between these two lines in public static function getFormatedName( ...) in ImageType.php in classes/ImageType.php

 

$theme_name = Context::getContext()->shop->theme_name;

 

"here should be that code "

 

$name_without_theme_name = str_replace(array('_'.$theme_name, $theme_name.'_'), '', $name);

 

there is a second step but it depends that in which module or where at your page the images are shown streched?

my problem was different from yours

if the images that is shown streched are from a module you can find function like this in the php codes of your module

Image::getSize('home'),

and changed it to

'homeSize' => Image::getSize('home_default'),

 

This one worked for me!. Thanks PS 1.5.3.1

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...