Jump to content
silentRun

Resizable PNG watermark module - Prestashop 1.5

Recommended Posts

done, thanks :)

i really appreciate it, i suppose that whole community also ;)

 

btw. you tested it only in latest 1.5.4.1 ?

  • Like 1

Share this post


Link to post
Share on other sites

I tested on ps 1.5.4 & 1.5.4.1, but it is based on the watermark module which comes with PS 1.5, so I think it is compatible with PS 1.5.X...

  • Like 1

Share this post


Link to post
Share on other sites

New version added, now the PNG watermark works better and always fit correctly on the image, based on a defined proportion

  • Like 1

Share this post


Link to post
Share on other sites

New version added, now the PNG watermark works better and always fit correctly on the image, based on a defined proportion

i have installed this module, but when i push regenerate button, i see this error (below).

I have not default theme and none-oiginal sizes for thumbinals. Ho to solve this?

 

Notice: Undefined variable: percentproportion in /home/plaza24/public_html/modules/watermark/watermark.php on line 349 Warning: imagecreatetruecolor(): Invalid image dimensions in /home/plaza24/public_html/modules/watermark/watermark.php on line 354 Warning: imagealphablending() expects parameter 1 to be resource, boolean given in /home/plaza24/public_html/modules/watermark/watermark.php on line 355 Warning: imagecopyresampled() expects parameter 1 to be resource, boolean given in /home/plaza24/public_html/modules/watermark/watermark.php on line 356 Warning: imagecopy() expects parameter 2 to be resource, boolean given in /home/plaza24/public_html/modules/watermark/watermark.php on line 374 Notice: Undefined variable: percentproportion in /home/plaza24/public_html/modules/watermark/watermark.php on line 349 Warning: imagecreatetruecolor(): Invalid image dimensions in /home/plaza24/public_html/modules/watermark/watermark.php on line 354 Warning: imagealphablending() expects parameter 1 to be resource, boolean given in /home/plaza24/public_html/modules/watermark/watermark.php on line 355 Warning: imagecopyresampled() expects parameter 1 to be resource, boolean given in /home/plaza24/public_html/modules/watermark/watermark.php on line 356 Warning: imagecopy() expects parameter 2 to be resource, boolean given

 

......................

 

home/plaza24/public_html/modules/watermark/watermark.php on line 356 Warning: imagecopy() expects parameter 2 to be resource, boolean given in /home/plaza24/public_html/modules/watermark/watermark.php on line 374 Warning: Cannot modify header information - headers already sent by (output started at /home/plaza24/public_html/modules/watermark/watermark.php:374) in /home/plaza24/public_html/classes/Tools.php on line 141

Share this post


Link to post
Share on other sites

i have tried on other server with default theme and it is working ... so trouble is in none default theme and images sizes ...

Share this post


Link to post
Share on other sites

i have tried on other server with default theme and it is working ... so trouble is in none default theme and images sizes ...

 

I'm going to check that

Edited by silentRun (see edit history)

Share this post


Link to post
Share on other sites

i have tried on other server with default theme and it is working ... so trouble is in none default theme and images sizes ...

 

Ok should be cool now. There was a problem with the watermark proportion...

I have tried it on default template and on custom template, with modified thumbnails size, and works well. Please download 0.6 and check again.

 

Thanks for your feedback

  • Like 1

Share this post


Link to post
Share on other sites

Ok should be cool now. There was a problem with the watermark proportion...

I have tried it on default template and on custom template, with modified thumbnails size, and works well. Please download 0.6 and check again.

 

Thanks for your feedback

0.6 version now working on custom theme too..

thanks for so fast support!

  • Like 1

Share this post


Link to post
Share on other sites

Hello, I have installed the module and have done everything. The water mark only shows up on pictures that i upload. Is there a way to get the watermark to appear on previous images? I have cleared my browsers cache and history etc.... everything. i even tried a browser that i dont use and i still cant get the images to appear on my older images. Thank you

 

 

Website

Edited by Tatttoo (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Hello, I have installed the module and have done everything. The water mark only shows up on pictures that i upload. Is there a way to get the watermark to appear on previous images? I have cleared my browsers cache and history etc.... everything. i even tried a browser that i dont use and i still cant get the images to appear on my older images. Thank you

 

regenerate your images in back office. there is option for that thing

Share this post


Link to post
Share on other sites

try to regenerate thumbnails, should help

 

Regenerate Images

 

You may be dissatisfied with your shop's current thumbnails size. This section makes it possible for you to regenerate them all – or only those for a specific type of content:

  • Change the image size settings in the table at the top of the "Images" preference page.
  • Select which content's images should be regenerated.
  • Indicate whether the previous thumbnails should be kept or not.
  • Click "Regenerate thumbnails".

pref024-imageRegenerate.png?version=1&modificationDate=1344444532000&api=v2

 

EDIT

ohh we replied at the same time, sorry!

i don't saw your entries

Share this post


Link to post
Share on other sites

Does it work for PS 1.3.6 or PS 1.4 ?

 

I dont think so, I modified the watermark module from PS 1.5.4... But you could try that and feedback me,that would be great !

Share this post


Link to post
Share on other sites

Hello, I have installed the module and have done everything. The water mark only shows up on pictures that i upload. Is there a way to get the watermark to appear on previous images? I have cleared my browsers cache and history etc.... everything. i even tried a browser that i dont use and i still cant get the images to appear on my older images. Thank you

 

 

Website

 

Hi there, I think that when you activate the watermark module, the watermark is only being applied to the new pictures you upload, even on the watermark original version from prestashop.

 

But to be sure, you could try to install & set up again the original watermark module (0.3) and regenerate the images as Vekia explained, but I think that result will be the same.

 

If you have a lot of images on your shop and re-uploading them seem to be a hard task, you could try another method I have on my blog, to apply a watermark trough htaccess:

 

PNG watermark by htaccess

 

Please feedback with comment if it works, thanks

Share this post


Link to post
Share on other sites

Hello, I have installed the module and have done everything. The water mark only shows up on pictures that i upload. Is there a way to get the watermark to appear on previous images? I have cleared my browsers cache and history etc.... everything. i even tried a browser that i dont use and i still cant get the images to appear on my older images. Thank you

 

 

Website

 

I have the same problem.

With new pictures, the watermark is working

With old pictures, after regenerating, the watermark is not applying...

 

It is the same issue with the original module from PS.

I use the 1.5.4.1

Any solution please ?

 

 

More information :

Normally, after regenerating, we have to get a "id-watermark.jpg" file : this file is missing.

When i create a new product, this "id-watermark.jpg" file is correctly creating.

Edited by kevin78 (see edit history)

Share this post


Link to post
Share on other sites

you regenerated thumbnails and even after regeneration watermark doesn't appear on the old pictures?

  • Like 1

Share this post


Link to post
Share on other sites

Yes I have regenerated images a few times. It don't show on images that were on there before installing module. New images that I add have the water Mark .

Share this post


Link to post
Share on other sites

you regenerated thumbnails and even after regeneration watermark doesn't appear on the old pictures?

 

Yes Vekia, I think that watermark is only applied in the new pictures the admin uploads, after activating the watermark module and regenerating the images. Watermark is not applied on the older pictures...

Share this post


Link to post
Share on other sites

you regenerated thumbnails and even after regeneration watermark doesn't appear on the old pictures?

 

Yes i have regenerated all pictures... For information, it is an upgraded from 1.4.5 to 1.5.4

I have a second shop with new installation. Everything is working.

 

I will make a new test with other upgraded shop but i think it will not work too...

Edited by kevin78 (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Hello, can you pls made option that do watermark possition by random?

Share this post


Link to post
Share on other sites

So this module also doesn't work in PS 1.5.4.1 when regenerating images?

Share this post


Link to post
Share on other sites

Well this topic was suggested as solution to problem that original module is not working.

 

So If I got it right now we have original module and this one which dont work when regenerating images.

Edited by Dolke (see edit history)

Share this post


Link to post
Share on other sites

Yes, the two modules do not work when the regeneration of images. However they all operate both when creating a new product.

  • Like 1

Share this post


Link to post
Share on other sites

The problem therefore is probably not the module but rather the regeneration that does not use the module.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the replay.

 

Then I guess we should wait for developers to fix this rather big problem.

Share this post


Link to post
Share on other sites

Hello guys,

 

In my side, the only solution i have found is the following :

 

- at first, i have to regenerate the pictures, because i have upgraded from v148 to v154, and consequently, i have changed also the template.

 

- the new template requires new images dimensions, so i had to regenerate all the products pictures.

 

- the regeneration of the images work with the watermark, when i was on my old version v148. So, i have created the new images, on the old version. I have regenerated all the pictures with my old prestashop version. I save all the pictures files.

 

- I have updraged my shop to v154

 

- I have move the saved pictures to the new shop, and now, i have correctly the pictures with watermark.

 

It was the only solution i have found !

  • Like 1

Share this post


Link to post
Share on other sites

Hello, can you pls made option that do watermark possition by random?

 

If you dont mind my question, Why do you need that ?

Share this post


Link to post
Share on other sites

Yes, the two modules do not work when the regeneration of images. However they all operate both when creating a new product.

 

Yes, you are right. The original 0.3 watermark module from prestashop, and my module, which is based on this previous one, neither of them apply the watermark to "old" images, just to the new ones added after admin regenerates the images, as it's mentioned here:

 

No, it works when creating new products, but not during the regeneration of images.

 

on the other hand

 

Well this topic was suggested as solution to problem that original module is not working.

 

So If I got it right now we have original module and this one which dont work when regenerating images.

 

This topic was suggested as a solution to implement a PNG watermark, and not a GIF watermark, also, the watermark keeps proportional to the original product image, function which is not present on the original 0.3 watermark module which comes with prestashop.

 

Sorry for the delay in answering, its holidays ;)

  • Like 1

Share this post


Link to post
Share on other sites

To be more sure, can anybody using prestashop 1.5.x feedback me, in the following cases:

 

- PS 1.5.x, with original watermark module 0.3, activate and set it up. Regenerate images... is the watermark being applied to just the new images uploaded after watermark module activation (new images), or to "all" images on the web ( old images ).

 

- PS 1.5.x, with custom watermark module 0.6, activate and set it up. Regenerate images... is the watermark being applied to just the new images uploaded after watermark module activation (new images), or to "all" images on the web ( old images ).

 

thanks in advance

Share this post


Link to post
Share on other sites

I have verified that, in both versions, the module work for images of a new product . But it does not work for the old images with regeneration.

Moreover the fact regenerate images, removes the watermark of these new products with which it had worked. The watermark thus applies only when creating a new product, and if the images are regenerated, it disappears.

 

I have prestashop 1.5.4.1

Share this post


Link to post
Share on other sites

I can relate to the post above. I have the same version and it also doesn't work for "old" images.

 

This is quite a problem for me as I need all of my images to have watermark.

 

This feature to use PNG instead of GIF images for watermark is great but you should fix this issue and make a great module :)

Share this post


Link to post
Share on other sites

The module is not working for me at all. I have a fresh install of 1.5.4.1, so I don't need to regenerate for this shop (I will have to for another shop that has been running on Prestashop for a while, so a solution for that would be helpful too).

 

It doesn't add the watermark to new products as well. Does anyone know how to fix this?

 

Thanks.

Share this post


Link to post
Share on other sites

The module is not working for me at all. I have a fresh install of 1.5.4.1, so I don't need to regenerate for this shop (I will have to for another shop that has been running on Prestashop for a while, so a solution for that would be helpful too).

 

It doesn't add the watermark to new products as well. Does anyone know how to fix this?

 

Thanks.

 

Sorry, after activating the watermark module, selecting the image etc, you have to regenerate the images. I have the module working on 3 sites with prestashop 1.5.4.x, so it should be working for you ;)

Share this post


Link to post
Share on other sites

There was only 1 test product in my website and regenerate didn't work for that one. Then I created another test product but also no watermark in the image..

Could it be the path to the watermark in de .tpl files or something?

Share this post


Link to post
Share on other sites

There was only 1 test product in my website and regenerate didn't work for that one. Then I created another test product but also no watermark in the image..

Could it be the path to the watermark in de .tpl files or something?

if you want, you could send me some credentials to access your presta admin, and take a look

Share this post


Link to post
Share on other sites

I have verified that, in both versions, the module work for images of a new product . But it does not work for the old images with regeneration.

Moreover the fact regenerate images, removes the watermark of these new products with which it had worked. The watermark thus applies only when creating a new product, and if the images are regenerated, it disappears.

 

I have prestashop 1.5.4.1

 

I can relate to the post above. I have the same version and it also doesn't work for "old" images.

 

This is quite a problem for me as I need all of my images to have watermark.

 

This feature to use PNG instead of GIF images for watermark is great but you should fix this issue and make a great module :)

 

Just to report you, that I set up 0.6 watermark module on the following user "Smijn1", and after regenerating the images, watermark was applied to all old images, not just the new ones... so you might be doing something wrong.

 

There was only 1 test product in my website and regenerate didn't work for that one. Then I created another test product but also no watermark in the image..

Could it be the path to the watermark in de .tpl files or something?

 

I fixed this issue, because user didnt have module activated, and also, because the proportion for the watermark was set to "0". Maybe someone has the same issue

  • Like 1

Share this post


Link to post
Share on other sites

Hi there. I update the plugin, so it's can work with custom transparency (bye-bye Photoshop for transparency) and any watermark file with correct output.

 

Maybe go on github? :)

watermark-0.7.zip

  • Like 2

Share this post


Link to post
Share on other sites

sure no problem... although I don't have yet a github account. What is needed to be done ? pm me please

 

Btw, I just tried the new update, but installation trough prestashop admin interface didn't success... was the same for you ?

Share this post


Link to post
Share on other sites

Just register an account on github. I already created repository, and here is the link: https://github.com/logical-and/prestashop-watermark . You don't need to fork the repository - write me your account, and I add you as collaborator.

 

Btw, I just tried the new update, but installation trough prestashop admin interface didn't success... was the same for you ?

Can you explain please on how to reproduct this failed installation?

Share this post


Link to post
Share on other sites

0.6 is working fine for me. The original watermark module would never be applied to regenerated images but this one is working fine. Also the .png images and auto resizing is a great feature.

Thanks for your great work.

Share this post


Link to post
Share on other sites

Hi there,

 

Here I show my little contribution to prestashop community, it is a basic upgrade to "watermark" moduke:

 

This is what it does:

 

- Allows to upload PNG watermark, instead of GIF

- Watermark is resized based on the width / height of the original image.

 

This way, we can create a watermark based on PNG ( which will always has better quality than GIF ).

 

Also, the 0.3 version of the module, depending on the size of the original image, the watermark will be shown sometimes too big, or too small, depending on the size of the original image. So now it's always proportional.

 

* initial versión: 0.4

* Now it only accepts PNG, no GIF allowed anymore

* Works with PS 1.5, didn't tried with older versions.

 

I got to this solution based on this prestashop support ticket, which says "open" & "unresolved", it could may be fixed with this update...

 

 

cheers !

 

## 11th July update ##

- Turkish translation added

 

## 17th July update ## version 0.5

- Fixed bug which make PNG resizing only when PNG was smaller than original image.

- Now PNG watermark is resized to fit correctly in the original image, no matter if the PNG is bigger o smaller than original image.

- Added watermark proportion. User can decide is the watermark should cover 100% of the image, 75%, 50%...

 

## 18th July update ## version 0.6

- Fixed bug of watermark proportion

- Create original image from jpg, gif or png

 

** If you find this module useful, please support my work with a little donation, I will appreciate it very much. Thanks

 

 

the OP version 6 worked for me  however not the first time because I did not uninstall the original module first (i think that is the reason). The version 6 does work if you uninstall and delete the original watermark module first. Version 7 (not by op) said successful install but the module did not appear. Not sure what is happening there but it did not work for me. Would be cool if it did though.

 

Any way.. Just letting people know. As i spent a few hours figuring out how to solve this. Thanks for everyone's help also. 

 

V6 is in the original post of this thread if anyone is looking for it.  

 

I vaguely recall fixing earlier versions of the stock watermark module by deleting the module then re-installing the module by hand. Wish i'd remembered doing that. Would have saved me an hour or so. Cheers!

  • Like 1

Share this post


Link to post
Share on other sites

0.6 is working fine for me. The original watermark module would never be applied to regenerated images but this one is working fine. Also the .png images and auto resizing is a great feature.

Thanks for your great work.

Thanks for the feedback!

Share this post


Link to post
Share on other sites

the OP version 6 worked for me  however not the first time because I did not uninstall the original module first (i think that is the reason). The version 6 does work if you uninstall and delete the original watermark module first. Version 7 (not by op) said successful install but the module did not appear. Not sure what is happening there but it did not work for me. Would be cool if it did though.

 

Any way.. Just letting people know. As i spent a few hours figuring out how to solve this. Thanks for everyone's help also. 

 

V6 is in the original post of this thread if anyone is looking for it.  

 

I vaguely recall fixing earlier versions of the stock watermark module by deleting the module then re-installing the module by hand. Wish i'd remembered doing that. Would have saved me an hour or so. Cheers!

 

Thanks !

Just register an account on github. I already created repository, and here is the link: https://github.com/logical-and/prestashop-watermark . You don't need to fork the repository - write me your account, and I add you as collaborator.

 

Btw, I just tried the new update, but installation trough prestashop admin interface didn't success... was the same for you ?

Can you explain please on how to reproduct this failed installation?

Logical-and, sorry for the late answer, I was busy with some stuff. The issue I experience is the same as jimmyc has, module seems to install, however, it is not found on the module administration windows... its like it is not installed correctly. I tried it on a couple os prestashop 1.5.4.x... did you do a manual installation ? or through the web ui ?

Share this post


Link to post
Share on other sites

0.7 version is original by author or not ? :)

0.7 is 0.6 version, but modified by "logical-and", although I haven't tried it yet...I'm bit busy right now

Edited by silentRun (see edit history)

Share this post


Link to post
Share on other sites

0.7 is 0.6 version, but modified by "jimmyc", although I haven't tried it yet...I'm bit busy right now

 

So, there should be not problem when I overwrite the folder in my modules folder with this new content via FTP I assume :)

Share this post


Link to post
Share on other sites

Well, for those who dont know, you should de-zip the https://github.com/l...hive/master.zip

and then, important, repack it like this.

 

de-zip the master.zip

go into the new folder until you see all the files

then go back one level

rename 'prestashop-watermark-master' to 'watermark'

zip (repack) this folder and you will get a zip called: watermark.zip

install as usual

(this accounts for most of the GIT or mod modules)

Share this post


Link to post
Share on other sites

Well, for those who dont know, you should de-zip the https://github.com/l...hive/master.zip

and then, important, repack it like this.

 

de-zip the master.zip

go into the new folder until you see all the files

then go back one level

rename 'prestashop-watermark-master' to 'watermark'

zip (repack) this folder and you will get a zip called: watermark.zip

install as usual

(this accounts for most of the GIT or mod modules)

 

Thanks. Do you mind, if I use your tip in git readme?

Share this post


Link to post
Share on other sites

Thanks for the module!

 

Worked for me.  Installed the module (no previous watermark), then regenerated images.  

 

Thanks again!

  • Like 1

Share this post


Link to post
Share on other sites

Hi guys,

 

I tested version 0.7 on my test website at test.dekom.co.rs

 

After successfully making new images I found out that all links are giving me page not found in the front end and that non of the images are actually visible. This is a complete clone of my main and live website www.dekom.co.rs

Dont know what is going on really...  <_<

Share this post


Link to post
Share on other sites

Hi guys,

 

I tested version 0.7 on my test website at test.dekom.co.rs

 

After successfully making new images I found out that all links are giving me page not found in the front end and that non of the images are actually visible. This is a complete clone of my main and live website www.dekom.co.rs

 

Dont know what is going on really...  <_<

Hi there, I've checked ur website, images seen cool for me, but without watermark...

Share this post


Link to post
Share on other sites

Hi SilentRun,

 

You looked at my main website probably.

 

Look at test.dekom.co.rs

This is clone of my main website that I made on subdomain so I can have testing ground that is almost 100% the same as the main, live website at www.dekom.co.rs


This is where Im testing watermark module version 0.7

It did quite a mess. 

 

P.S. If you need credentials to check whats going on with this in my backend please, I invite you to come and take a look.

Share this post


Link to post
Share on other sites

Hi SilentRun,

 

You looked at my main website probably.

 

Look at test.dekom.co.rs

This is clone of my main website that I made on subdomain so I can have testing ground that is almost 100% the same as the main, live website at www.dekom.co.rs

 

 

This is where Im testing watermark module version 0.7

It did quite a mess. 

 

P.S. If you need credentials to check whats going on with this in my backend please, I invite you to come and take a look.

Can you try watermark module 0.6 and check the result ?

Also, I recommend you to re-enable the right click, I think it improves the user experience... however, it's just my opinion ;)

Share this post


Link to post
Share on other sites

Thanks for advice Silent, I guess it can be quite irritating sometimes so I will reconsider enabling it.

Sure I will go with 0.6 version and test it.

I'll reply in shortly.

P.S. I would be performing this previews regeneration first, thank you logical-and.

Edited by Dolke (see edit history)

Share this post


Link to post
Share on other sites

I just made regeneration procedure. I included only my products and only small_default images.

Result remains the same.

have you also noticed how all the links to products and pages are gone? Its showing "page not found" every time...

Share this post


Link to post
Share on other sites

have you also noticed how all the links to products and pages are gone? Its showing "page not found" every time...

 

That's the weird thing... since, ok, maybe images are gone, but user should still be able to see the product... ¿?

Share this post


Link to post
Share on other sites

Silent, I didn't yet try with your version 0.6

I'm doing that right now. 

Yes its totally weird. I only see home page and then whatever i click from there it just breaks.

 

I'll report back in a few minutes.

Update:
Result is completely the same even with 0.6 version of the module.

Edited by Dolke (see edit history)

Share this post


Link to post
Share on other sites

Yes its totally weird. I only see home page and then whatever i click from there it just breaks.

 

May it be related to .htaccess?

Edited by silentRun (see edit history)

Share this post


Link to post
Share on other sites

I'm afraid to use it on the main site but it might have to do with .htaccess file.

 

Can I some how reset the file on my test site and see if this was the issue?

One more time to point out the versions and environment:

PS version 1.5.4.1
I'm using only one shop and only one language
Tried with original 03, then 0.6 and 0.7 version of the module.

 

Non of them works on my test site.

Edited by Dolke (see edit history)

Share this post


Link to post
Share on other sites

To reset htaccess file, go to preferences-> performance, uncheck htaccess, save, check it again, and save again... this should reset it...

Share this post


Link to post
Share on other sites

That did the trick. I have images back and all pages are working. "image not available" image is now everywhere where I don't have images of my products. I will test 0.6 version of module again.

Update:

I regenerated images again, this time I didn't experience previous problem but there is not watermark on any image. I used non transparent PNG image for my watermark, maybe I did something wrong at that step?

Edited by Dolke (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

@logical_and

 

Better you check if it is correct what I wrote. Especially, since am not a native English speaker...

But else, fell free to do publicize I wrote :)

My thanks go out to you and for the decision to use git.

Share this post


Link to post
Share on other sites

I have migrated my shop to the main domain from a subdomain and now the watermark is not there. I have tried reinstalling the module, regenerated the images, upload the watermark again and then regenerate etc... but can't seem to make it work.. any idea how to fix this?

 

thanks

Share this post


Link to post
Share on other sites

Hello everyone.

 

I'd same troubles as mentioned before - no watermark after image regeneration. This was strange because it worked ok before and no change to modules was made. So I go deep into the code (I have Presta 1.5.5).

 

Let's look at file /controllers/admin/AdminImagesController.php we need _regenerateThumbnails function - it regenerates images from admin image tab.

if (($return = $this->_regenerateNewImages($proc['dir'], $formats, ($proc['type'] == 'products' ? true : false))) === true)
{
	if (!count($this->errors))
		$this->errors[] = sprintf(Tools::displayError('Cannot write %s images. Please check the folder\'s writing permissions %s.'), $proc['type'], $proc['dir']);
}
elseif ($return == 'timeout')
	$this->errors[] = Tools::displayError('Only part of the images have been regenerated. The server timed out before finishing.');
else
{
	if ($proc['type'] == 'products')
		if ($this->_regenerateWatermark($proc['dir']) == 'timeout')

This means that if errors occured it will not regenerate watermarks. I have few products with deleted through ftp images, but I want watermarks generated for other ones.

// Generate new images
if (($return = $this->_regenerateNewImages($proc['dir'], $formats, ($proc['type'] == 'products' ? true : false))) === true)	{
	if (!count($this->errors)) $this->errors[] = sprintf(Tools::displayError('Cannot write %s images. Please check the folder\'s writing permissions %s.'), $proc['type'], $proc['dir']);
} elseif ($return == 'timeout') {
	$this->errors[] = Tools::displayError('Only part of the images have been regenerated. The server timed out before finishing.');
}
// Generate watermarks
if ($proc['type'] == 'products') {
	if ($this->_regenerateWatermark($proc['dir']) == 'timeout') $this->errors[] = Tools::displayError('Server timed out. The watermark may not have been applied to all images.');
}
// If no errors found, regenerate "no picture" images
if (!count($this->errors)) {
	if ($this->_regenerateNoPictureImages($proc['dir'], $formats, $languages)) $this->errors[] = sprintf(Tools::displayError('Cannot write "No picture" image to (%s) images folder. Please check the folder\'s writing permissions.'), $proc['type']);
}

I rewrote this, but still there is no watermarks after regeneration.

 

After some time I'd noticed that there is also mysql error "mysql had gone away". This means that now it tries to regenerate watermark images, but mysql connection was closed already. We need DB to check module watermark is there and get all the images for products.

 

Mysql docs says about this problem:

"The solution to this is to either do a mysql_ping() on the connection if there has been a long time since the last query (this is what Connector/ODBC does) or set wait_timeout on the mysqld server so high that it in practice never times out."

 

So I choose to set wait_timeout in /etc/mysql/my.cnf from 60 to 900 and it helped! Set value higher if you have slow server or/and many products.

 

In attachment changed file. Hope it helps someone.

watermark_fix_regen.zip

  • Like 3

Share this post


Link to post
Share on other sites

Hm, so If I got it right module was not generating problem it self but issue was with mySQL time out and huge number of images that watermark needed to be applied?

 

Is this solution for Prestashop 1.5.4.1 as well?

 

Thank you.

Share this post


Link to post
Share on other sites

Yep, mySQL waiting time is the key to the problem and also deleted images through ftp (because it will not find it and generate error before watermark process).

Share this post


Link to post
Share on other sites

This was great thing to notice and not easy as well I guess. 

Great job in that case.

Im just not clear with this second part deleted images using FTP?

Do you care explaining it to me in details, thanks.

 

Share this post


Link to post
Share on other sites

FYI, if not to delete images (turn off the checkbox), then process willl go as expected - with the watermark handling.

  • Like 1

Share this post


Link to post
Share on other sites

Im just not clear with this second part deleted images using FTP?

Do you care explaining it to me in details, thanks.

 

 

Well in my case there was some images missing, maybe shop owner deleted it through FTP instead of Prestashop admin panel. So in db there was link to files that acutally missing. After this kind of error, watermark generation process is not started in default code.

Share this post


Link to post
Share on other sites

FYI, if not to delete images (turn off the checkbox), then process willl go as expected - with the watermark handling.

Would you please explain me what is the actual difference between checking and not checking that option?

Share this post


Link to post
Share on other sites

I see Fr0sty. 

So basically it would be good not to check that option as logical suggested so watermark should be applied without any problems.

Sorry but Im still not sure what do I have to do now?

This file you gave us is what exactly?
Do I need to replace that file or change that value or both?
 

Edited by Dolke (see edit history)

Share this post


Link to post
Share on other sites