Portal Home > Knowledgebase > Articles Database > Watermark function won't work after PHP upgrade


Watermark function won't work after PHP upgrade




Posted by mifbody, 08-31-2009, 08:59 AM
Hey guys, The following script worked when I was using a version of WAMP (Windows Apache MySQL PHP) that had Apache 2.2.8 and PHP 5.2.6 - the current WAMP that I had to install is Apache 2.2.11 and PHP 5.3.0. Now I've noticed my watermark function no longer works. I've been able to confirm that GD support does exist ( http://mifbody.com/test.php ) but yet the images appear broken if they use the below watermark function. Any ideas?

Posted by blong, 08-31-2009, 09:34 AM
Hello, You can give this a try, not sure if it'll work or not. I made some changes though.

Posted by 2Grumpy, 08-31-2009, 09:50 AM
Do you get any errors? Check your error_log (depends on how your system is setup where this would be and even what it's named). Sometimes running a script interactively on the command line from a shell can shed some light as well.

Posted by mifbody, 08-31-2009, 09:51 AM
Thanks for the help! Unfortunately it still displays a broken image: http://mifbody.com/dtcs/DTC%20029.jpg

Posted by mifbody, 08-31-2009, 09:58 AM
D'oh - should have checked that first. Here's what I see in the apache error log: [Mon Aug 31 09:55:03 2009] [error] [client 206.57.42.130] PHP Notice: Undefined variable: outputType in C:\\wamp\\www\\mifbody\\watermark\\watermark.php on line 30 [Mon Aug 31 09:55:03 2009] [error] [client 206.57.42.130] PHP Deprecated: Function eregi_replace() is deprecated in C:\\wamp\\www\\mifbody\\watermark\\watermark.php on line 93 [Mon Aug 31 09:55:03 2009] [error] [client 206.57.42.130] PHP Deprecated: Function eregi_replace() is deprecated in C:\\wamp\\www\\mifbody\\watermark\\watermark.php on line 93 [Mon Aug 31 09:55:04 2009] [error] [client 206.57.42.130] PHP Deprecated: Function eregi_replace() is deprecated in C:\\wamp\\www\\mifbody\\watermark\\watermark.php on line 93 [Mon Aug 31 09:56:16 2009] [error] [client 173.76.164.53] PHP Notice: Undefined variable: outputType in C:\\wamp\\www\\mifbody\\watermark\\watermark.php on line 30, referer: http://www.webhostingtalk.com/showthread.php?p=6366440 [Mon Aug 31 09:56:16 2009] [error] [client 173.76.164.53] PHP Deprecated: Function eregi_replace() is deprecated in C:\\wamp\\www\\mifbody\\watermark\\watermark.php on line 93, referer: http://www.webhostingtalk.com/showthread.php?p=6366440 [Mon Aug 31 09:56:16 2009] [error] [client 173.76.164.53] PHP Deprecated: Function eregi_replace() is deprecated in C:\\wamp\\www\\mifbody\\watermark\\watermark.php on line 93, referer: http://www.webhostingtalk.com/showthread.php?p=6366440 [Mon Aug 31 09:56:17 2009] [error] [client 173.76.164.53] PHP Deprecated: Function eregi_replace() is deprecated in C:\\wamp\\www\\mifbody\\watermark\\watermark.php on line 93, referer: http://www.webhostingtalk.com/showthread.php?p=6366440

Posted by mifbody, 08-31-2009, 10:12 AM
I fixed the first error message about $OutputType being unrecognized (put it before the watermark() call. It looks like eregi is not compatible with PHP 5.3.0. Anyone know how to convert that to preg_replace?

Posted by mattle, 08-31-2009, 06:30 PM
Well, for starters, you never needed eregi_replace() in here...ereg_replace would have worked just fine. You're not doing anything in the Regular Expression itself that isn't PCRE-compatible, so just wrap your pattern in delimiters and you should be set: Of course this demonstrates Perl's never-ending superiority over PHP.

Posted by mifbody, 08-31-2009, 09:57 PM
That worked perfectly - thank you!!!!



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
CloudWeb Hosting (Views: 456)
rate point...any good (Views: 509)