php-gd

PHP: Determine Visually Corrupted Images (yet valid) downloaded via Curl with GD/Imagemagick

别来无恙 提交于 2019-11-28 10:22:06
I'm using Curl via Proxies to download images with a scraper I have developed. Unfortunately, it gets the odd image which looks like these and the last one is completely blank :/ When I test the images via imagemagick (using identify) it tells me they are valid images. When I test the images via exif_imagetype() and imagecreatefromjpeg() again, both these functions tell me the images are valid. Does anyone have a way to determine if the image has majority of greyness or is completely blank/white and these are indeed corrupted images? I have done a lot of checking with other questions on here,

PHP Fatal error: Call to undefined function imagettftext()

妖精的绣舞 提交于 2019-11-27 20:03:42
Why am I getting the error PHP Fatal error: Call to undefined function imagettftext() on line 29? <?php ob_start(); session_start(); $strings = '123456789'; $i = 0; $characters = 6; $code = ''; while ($i < $characters) { $code .= substr($strings, mt_rand(0, strlen($strings)-1), 1); $i++; } $_SESSION['captcha'] = $code; //generate image $im = imagecreatetruecolor(124, 40); $foreground = imagecolorallocate($im, 0, 0, 0); $shadow = imagecolorallocate($im, 173, 172, 168); $background = imagecolorallocate($im, 255, 255, 255); imagefilledrectangle($im, 0, 0, 200, 200, $background); // use your own

how to draw semi-transparent rectangle in php?

本秂侑毒 提交于 2019-11-27 16:38:08
问题 Here is an example what I would like to do: Here is the result: function red_rectangle($img_src,$x1,$y1,$x2,$y2,$tr = 50) { // Load image $img = imagecreatefromjpeg($img_src); // Transparent red $red = imagecolorallocatealpha($img, 255, 0, 0, $tr); // Draw a white rectangle imagefilledrectangle($img, $x1, $y1, $x2, $y2, $red); // Save the image (overwrite) imagejpeg($img, $img_src); imagedestroy($img); } 回答1: You need to use http://php.net/manual/en/function.imagefilledrectangle.php, passing

Yosemite / El Capitan php-gd + mcrypt installation

喜欢而已 提交于 2019-11-26 17:14:52
How to install/enable php-gd and mcrypt in Yosemite 10.10 - PHP 5.5.14 build? note that following steps install newest PHP 5.5.x To check if you have gd and mcrypt installed use $ php -m to display compiled in modules, continue if you are missing desired modules and please see accepted answer . GD So, Apple installed GD (and you're using their build of PHP, which is fine), but did not include support for PNG. You are definitely missing "full" gd (with png support) module if: imagecreatefrompng() function is missing. "Call to undefined function imagecreatefrompng()" Mcrypt install brew using