note 81831 added to function.imagecreate
| From: | sk89q at osu1 dot php dot net | Date: | Fri, 14 Mar 2008 22:14:44 +0000 |
| Subject: | note 81831 added to function.imagecreate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-137077@lists.php.net to get a copy of this message | ||
Loads a file based on its filetype and returns false if it fails.
<?php
function imagecreatefromfile($path, $user_functions = false)
{
$info = @getimagesize($path);
if(!$info)
{
return false;
}
$functions = array(
IMAGETYPE_GIF => 'imagecreatefromgif',
IMAGETYPE_JPEG => 'imagecreatefromjpeg',
IMAGETYPE_PNG => 'imagecreatefrompng',
IMAGETYPE_WBMP => 'imagecreatefromwbmp',
IMAGETYPE_XBM => 'imagecreatefromwxbm',
);
if($user_functions)
{
$functions[IMAGETYPE_BMP] = 'imagecreatefrombmp';
}
if(!$functions[$info[2]])
{
return false;
}
if(!function_exists($functions[$info[2]]))
{
return false;
}
return $functions[$info[2]]($path);
}
?>
----
Server IP: 208.69.120.35
Probable Submitter: 138.23.21.189
----
Manual Page -- http://www.php.net/manual/en/function.imagecreate.php
Edit -- https://master.php.net/note/edit/81831
Del: integrated -- https://master.php.net/note/delete/81831/integrated
Del: useless -- https://master.php.net/note/delete/81831/useless
Del: bad code -- https://master.php.net/note/delete/81831/bad+code
Del: spam -- https://master.php.net/note/delete/81831/spam
Del: non-english -- https://master.php.net/note/delete/81831/non-english
Del: in docs -- https://master.php.net/note/delete/81831/in+docs
Del: other reasons-- https://master.php.net/note/delete/81831
Reject -- https://master.php.net/note/reject/81831
Search -- https://master.php.net/manage/user-notes.php