|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-01-08 22:07 UTC] humbads at alum dot mit dot edu
Description: ------------ imagecreatefromstring is writing a warning message to stderr that can not be suppressed by '@' or captured by the error handler. It should emit a proper PHP warning instead. I have the following version of libPNG: php -i | grep -i libpng libPNG Version => 1.6.19+apng To run the test script, download the sample PNG image from here: http://imgbox.com/BzOXLiOr Note: libPNG 1.5.18 on PHP 5.6.17 for Windows does not have this problem. Test script: --------------- php -r '@var_dump(imagecreatefromstring(file_get_contents("1CCHOHSULGF78KW.png")));' Expected result: ---------------- resource(6) of type (gd) Actual result: -------------- libpng warning: iCCP: known incorrect sRGB profile resource(6) of type (gd) PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
$imgInfo = getimagesize($imageFile); $img_w = $imgInfo[0]; $img_h = $imgInfo[1]; switch ($imgInfo[2]){ case 1: $bgImg =imagecreatefromgif($imageFile); //gif break; case 2: $bgImg =imagecreatefromjpeg($imageFile); //jpg break; case 3: $bgImg = imagecreatefrompng($imageFile); //png break; default: die("不支持的图片文件类型"); exit; } $fontfile = ROOT_DIR.'/../../Resources/font/simhei.ttf'; $fontfile = ROOT_DIR.'/font/simhei.ttf'; if(file_exists($fontfile)){ echo $imageFile."\n\n"; } $text_color = imagecolorallocatealpha($bgImg,0,0,0,75); $pos_x = 30; $pos_y = $img_h - 20; imagettftext($bgImg, 12, 0, $pos_x, $pos_y, $text_color, $fontfile, '审核药师:'); $shenhe_img = imagecreatefrompng( ROOT_DIR.'/yaoshi/'.$shenhe ); $shenheImgInfo = getimagesize( ROOT_DIR.'/yaoshi/'.$shenhe ); $resize_h = 35; $resize_w = intval($shenheImgInfo[0]*$resize_h/$shenheImgInfo[1]); $pos_x = 110; $pos_y = $img_h-$resize_h-5; imagecopyresized($bgImg, $shenhe_img, $pos_x, $pos_y, 0, 0, $resize_w, $resize_h, $shenheImgInfo[0], $shenheImgInfo[1]);