Home »
Imported messages »
comp.lang.php »
imagecreatefromstring - errort test never fails???
imagecreatefromstring - errort test never fails??? [message #182473] |
Tue, 06 August 2013 21:02 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma:
|
Senior Member |
|
|
I have used this as follows
$im=imagecreatefromstring($code);
if($im != FALSE)
{
// resize what's in $code into a thumbnail for use in the database
}
else
// insert an arbitrary thumbnail that represents 'not actually an
image at all'
HOWEVER
If it is a recognisable image, really good thumbnails are created
BUT
if it is NOT an image. the code never executes the 'else' clause and I
just get errors like this
PHP Warning: imagecreatefromstring(): Data is not in a recognized format
in the logs. and three bytes of rubbish ( the string INF) in the
thumbnail!! (INvalid Format? ??)
The manual clearly seems to state that imagecreatefromstring() will
return FALSE if it fails to ID a valid image. NOT spit out an error.
"Return Values
An image resource will be returned on success. *|FALSE|* is returned if
the image type is unsupported, the data is not in a recognised format,
or the image is corrupt and cannot be loaded."
I have tried !=FALSE and !== FALSE with no effect.
Is this a bug, or just me being dumb?
I cant believe it has gone unnoticed if its a bug surely?
--
Ineptocracy
(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
|
|
|
Goto Forum:
Current Time: Thu Nov 28 16:54:40 GMT 2024
Total time taken to generate the page: 0.04968 seconds