Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #10424
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | imagecreatefromstring - errort test never fails??? |
| Date | 2013-08-06 22:02 +0100 |
| Organization | albasani.net |
| Message-ID | <ktro9b$7p8$1@news.albasani.net> (permalink) |
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.
Back to comp.lang.php | Previous | Next — Next in thread | Find similar | Unroll thread
imagecreatefromstring - errort test never fails??? The Natural Philosopher <tnp@invalid.invalid> - 2013-08-06 22:02 +0100 Re: imagecreatefromstring - errort test never fails??? The Natural Philosopher <tnp@invalid.invalid> - 2013-08-06 22:16 +0100
csiph-web