PNG Watermark?

vor0nwe

Joined: 2009-09-22
Posts: 4
Posted: Fri, 2010-08-13 21:38

I'm having a similar issue, except that I couldn't upload any type of image for my watermarks. (Running Gallery3 RC2)
After a bit of judicious spelunking in the Gallery3 code looking for 'validation' and 'invalid_type', I ended up in gallery3/modules/forge/libraries/Form_Upload.php, near line 139.

It would appear that that upload form accepts or rejects the image based on the MIME-type sent by the browser(!).

A very quick and REALLY dirty workaround for me was to change the rule to accept everything by default, upload the new watermark, and revert the code change.

So I changed line 139 of gallery3/modules/forge/libraries/Form_Upload.php from
// Allow nothing by default
$allow = FALSE;
to
$allow = TRUE; // TODO: Revert this dirty hack!!!

Then the transparent PNG was accepted without a hitch.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2010-08-14 18:15

@vor0nwe: please provide us with a link to your watermark and I'll test it out as well.
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git

 
heycd

Joined: 2007-04-29
Posts: 14
Posted: Fri, 2010-08-20 21:50

I tried changing the Graphics to ImageMagick, which required going into Advanced Prefs (apparently /usr/bin/ is sort of obscure to G3), then tried clearing Old Files and my png was still rejected.

Found this and it worked perfectly for me...could it be a mime-type issue with Firefox-based browsers? I'm using bleeding edge Seamonkey build....

Quote:
* cc vor0nwe added
* status changed from closed to reopened
* version changed from GIT HEAD to 3.0 RC 2
* resolution worksforme deleted
* milestone changed from 3.0 RC 2 to 3.0

I'm having a similar issue, except that I couldn't upload any type of image for my watermarks. (Running Gallery3 RC2)
After a bit of judicious spelunking in the Gallery3 code looking for 'validation' and 'invalid_type', I ended up in gallery3/modules/forge/libraries/Form_Upload.php, near line 139.

I haven't looked at it very thoroughly, but it would appear that that upload form accepts or rejects the image based on the MIME-type sent by the browser(!).

A very quick and REALLY dirty workaround for me was to change the rule to accept everything by default, upload the new watermark, and revert the code change.

So I changed line 139 of gallery3/modules/forge/libraries/Form_Upload.php from

// Allow nothing by default
$allow = FALSE;

to

$allow = TRUE; // TODO: Revert this dirty hack!!!

Then the transparent PNG was accepted without a hitch.

Could someone adjust that test so that it'll accept a file based on it actually being a valid file format? Or, if that's too difficult, by file extension?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2010-08-21 17:59

@heycd: We expect /usr/bin to be in the PATH for your web server. Is it not? That'd be really weird. What's your server's PATH set to? Check your phpinfo for that.

I still can't reproduce this problem :-/
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git

 
vor0nwe

Joined: 2009-09-22
Posts: 4
Posted: Sun, 2010-08-22 20:02

@bharat,

These are the files that didn't work originally:

http://home.martijn.coppoolse.com/test/%C2%A9%20Martijn%20Coppoolse%20%28watermark%29.png
http://home.martijn.coppoolse.com/test/%C2%A9%20Martijn%20Coppoolse%20%28watermark%29.jpg
http://home.martijn.coppoolse.com/test/%C2%A9%20Martijn%20Coppoolse%20%28watermark%29.gif

But as I said, after temporarily changing the FALSE to TRUE, the PNG one was accepted without problem.

I'll try and see if sending a different MIME-type changes anything.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2010-08-22 20:18

vor0nwe,
I was able to add those as a watermark. What if you rename them without the © and spaces?
Also make sure you are running the most recent experiential code from GIT as well. The RC2 version did not work for me.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
vor0nwe

Joined: 2009-09-22
Posts: 4
Posted: Mon, 2010-08-23 14:46
floridave wrote:
What if you rename them without the © and spaces?

I'd renamed them to watermark.* as well, to no avail.

floridave wrote:
Also make sure you are running the most recent experiential code from GIT as well. The RC2 version did not work for me.

Ah, so it might have been fixed in the meantime. I only tried it with RC2. I'll see if I can get the code from git, and test it again. This probably won't be before Wednesday.

 
umbralechoes

Joined: 2010-03-15
Posts: 7
Posted: Thu, 2010-10-07 01:44
Quote:
I tried changing the Graphics to ImageMagick, which required going into Advanced Prefs (apparently /usr/bin/ is sort of obscure to G3), then tried clearing Old Files and my png was still rejected.

Found this and it worked perfectly for me...could it be a mime-type issue with Firefox-based browsers? I'm using bleeding edge Seamonkey build....

I've had the same problem -- can't upload PNGs as watermarks, but I'm able to upload them as gallery files fine, and I can upload JPG and GIF files as watermarks fine too. I'm using ImageMagick 6.6.3-10. The only way I was able to upload a PNG watermark was by doing what you said. Thanks for the suggestion!

Edit: I'm also using the latest Chrome (6.0.472.63), but I also tried it on Firefox (3.6.10) and it still didn't work without using this trick. And I'm using the final release version of Gallery 3.0.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Fri, 2010-10-08 05:06

Please file a ticket and attach your watermark image and we'll try to reproduce and fix it.
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git

 
umbralechoes

Joined: 2010-03-15
Posts: 7
Posted: Fri, 2010-10-08 13:32

Okay, ticket filed. Thanks!

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2010-10-08 18:20

Please post a link to the ticket. I was going to, but I can't find it.

https://sourceforge.net/apps/trac/gallery/report/1?asc=0&sort=created

____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
umbralechoes

Joined: 2010-03-15
Posts: 7
Posted: Fri, 2010-10-08 18:23

I reopened an old ticket that seemed to be the exact same issue.

http://sourceforge.net/apps/trac/gallery/ticket/797