php-gd

Ajax and returning image created by PHP GD

左心房为你撑大大i 提交于 2019-12-20 03:15:04
问题 I have a PHP script that generates an image with PHP GD. After it generates the image, it saves it, and send this output when called by Ajax: imagejpeg($img_data, 'filename.jpg'); echo '<img src="/filename.jpg.jpg">'; And after that, the image is shown on the page, and everything is fine. But, I don't want to create an image every time. Is there some way that I return by Ajax only $raw_data string and show the image? I tried like this: echo $img_data; But no luck, only thing that is returned

Yosemite / El Capitan php-gd + mcrypt installation

£可爱£侵袭症+ 提交于 2019-12-17 03:53:19
问题 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:

Fix corrupt png (truncated data) in PHP

人盡茶涼 提交于 2019-12-13 22:05:16
问题 I have a png which is supposedly corrupt, but still loads in all desktop image viewers, but not php. The error when calling imagecreatefrompng is: Warning: imagecreatefrompng(): gd-png: fatal libpng error: Read Error: truncated data in test.php on line 45 Warning: imagecreatefrompng(): gd-png error: setjmp returns error condition in test.php on line 45 Warning: imagecreatefrompng(): 'test.png' is not a valid PNG file in test.php on line 45 is there anyway of fixing the image in PHP before

My PHP cannot create a true color image

回眸只為那壹抹淺笑 提交于 2019-12-13 21:26:03
问题 I have a script that used to create a true color image. But after changing of server the new PHP installation does not show the image. Here is the example: http://www.europasprak.com/engine/system/utils/printBarImage.php?color=%239999FF&width=3&height=10 The source code is: <?PHP require_once("website.php"); $color = LibEnv::getEnvHttpGET("color"); $width = LibEnv::getEnvHttpGET("width"); $height = LibEnv::getEnvHttpGET("height"); $color = urldecode($color); if ($color && $width > 0 &&

The code is sending 2 times without proper image

南楼画角 提交于 2019-12-12 16:04:06
问题 I tried this code from the post, but this code is sending two emails on a single run of file. Email file is sending email two times using php mail function Let me know what i am doing wrong - <?php function mytextoverimage( $mytext ) { $headurl = 'http://dummyimage.com/600x400/ffffee/00d5ff.jpg'; header('Content-type: image/jpeg'); $jpg_image = imagecreatefromjpeg($headurl); $black = imagecolorallocate($jpg_image, 1, 1, 1); $font_path = 'myfont/arial.ttf'; $text = $mytext; imagettftext($jpg

Email file is sending email two times using php mail function

﹥>﹥吖頭↗ 提交于 2019-12-12 16:02:45
问题 My three concerns, tried different combos with no result, googled but little or no help -- I received two times the email,change myemail@emailserver.com to the email id to see the result. While executing this file I am getting image, however I want to have text "Email Sent". Full HTML content with tag is passed instead of HTML rendering in email. My Working Code --> <?php header('Content-type: image/jpeg'); $jpg_image = imagecreatefromjpeg('http://dummyimage.com/600x400/f5f5f5/fff.jpg');

Center text on image using PHP GD

随声附和 提交于 2019-12-12 09:57:50
问题 So I am creating a banner generator. I will be adding text in the middle, but would like it to be exactly in the center. I know that imagettftext can be used to write onto the banner, but that won't center it. A likely solution could be to find the width of the text and then use half of it taken away from half of the banner width, but I've got no idea about how to do this. I am using PHP-GD and do not want to use anything else I will have to install. imagettftext($img, 14, 0, (468 - ((strlen(

Is there any php function that returns an image handle so that i can use it in img src html tag?

余生长醉 提交于 2019-12-12 03:48:40
问题 I tried this imagejpeg() php method, but it returns an image to a browser on running the code. However I need a method that returns an image URL so that i can use it in my img tag. Currently i have to use - <img src="siteurl/myphpfile.php" /> but i think its better if the method returns an image handler so that i can use it in my img tag, like - <img src="image.jpg" /> My myphpfile.php is the file that contains the code. Searched many functions at php manuals but no luck, I am also using this

PHP imageconvolution() leaves black dot in the upper left corner

丶灬走出姿态 提交于 2019-12-10 19:55:14
问题 I'm trying to sharpen resized images using this code: imageconvolution($imageResource, array( array( -1, -1, -1 ), array( -1, 16, -1 ), array( -1, -1, -1 ), ), 8, 0); When the transparent PNG image is sharpened, using code above, it appears with a black dot in the upper left corner (I have tried different convolution kernels, but the result is the same). After resizing the image looked OK. 1st image is the original one 2nd image is the sharpened one EDIT : What am I going wrong? I'm using the

How to merge multiple images and text into single image?

若如初见. 提交于 2019-12-10 16:45:42
问题 I have multiple PNG images inside a div, those images are PNG and presents as single image for user depending on custom options he/she has selected. Also, adding text is also enabled as other feature, which allows a div with texts to add above of those images. Now i want to generate a image with those multiple images and text combined, maintaining the font-family & size of text. For eg. the image that appears on interface with combination of images and text. (It's managed to appear with css