gd

PHP GD Text and Special Characters / Encoding?

戏子无情 提交于 2019-12-12 03:04:41
问题 I'm generating text in php using imagettftext. the text is being pulled from a mysql database. some characters are not appearing in the rendered text despite being in the character map for the font and appearing in the database. for example, m-dashes (—)and smartquotes/apostrophes (“”’). the characters either don't appear or are replaced by question marks. i suspect this has to do with encoding, but i don't know enough about encoding to know where to start. any help would be much appreciated.

How to get image size from a canvas?

拟墨画扇 提交于 2019-12-12 02:53:43
问题 Is it possible to get the image size in pixels from a canvas? E.g. I know I can achieve it getting the size from the image directly: list($width, $height) = @getimagesize($_FILES['inputFieldName']['tmp_name']) but I want to get it from a canvas. E.g.: $canvas = imagecreatefromjpeg($image_path); //Get image size from $canvas 回答1: Try: $canvas = imagecreatefromjpeg($image_path); $width = imagesx($canvas); $height = imagesy($canvas); Details at http://es1.php.net/manual/en/function.imagesx.php

Place an image to the center of another image using PHP GD

元气小坏坏 提交于 2019-12-12 02:42:15
问题 I need to place an image to the center of another image(both horizontally and vertically) with dimension 700*350. I'm trying with the following code. But I'm getting image as stretched. @header("Content-Type: image/png"); $imageURL = "flower.jpg"; // create a transparent background image for placing the $imageURL image $imageResource = imagecreatetruecolor(700, 350); imagesavealpha($imageResource, true); $transparentColor = imagecolorallocatealpha($imageResource, 0, 0, 0, 127); imagefill(

Cannot install GD on centos 5.8

拥有回忆 提交于 2019-12-12 01:58:58
问题 /usr/bin/ld: skipping incompatible /usr/lib/libgd.so when searching for -lgd /usr/bin/ld: skipping incompatible /usr/lib/libgd.a when searching for -lgd /usr/bin/ld: cannot find -lgd collect2: ld returned 1 exit status make: *** [blib/arch/auto/GD/GD.so] Error 1 /usr/bin/make -- NOT OK Running make test Can't test without successful make Running make install make had returned bad status, install seems impossible I'm trying to install GD.pm on centos 5.8 and stuck on this problem. I have

Generate multiple images with PHP

好久不见. 提交于 2019-12-12 01:44:57
问题 Code $files = scandir("images"); $exclude = array(".", ".."); $images = array_diff($files, $exclude); foreach($images as $image) { $original_image = imagecreatefromjpeg("images/{$image}"); $original_width = imagesx($original_image); $original_height = imagesy($original_image); $new_width = 180; $new_height = floor($original_height * ($new_width/$original_width)); $new_image = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($new_image, $original_image, 0, 0, 0, 0, $new_width,

Blending colors GD - PHP

血红的双手。 提交于 2019-12-12 01:39:29
问题 Ok, I have a 64x64 pixels image, some pixels are white, some are grey, and some darker, so I have another 64x64 pixel image with some yellow pixels which will determine which pixels of the first image must be changed. So far I could change the colors on the first image with the following code, but the thing is I have no idea how to "blend" the given color with the colors that were already on the first image. For example, if a pixel is white (255,255,255) and the new color is red (255,0,0) the

How to use/link gdLibrary (libgd) with MS Visual C++ (e.g. 2008 Express Edition)? Getting LNK2019 errors

若如初见. 提交于 2019-12-12 00:38:26
问题 I have to use the gdLibrary (http://www.libgd.org) in a C++ App on MS Windows XP Prof. SP3 32bit - and I'm trying and googleing for two days now without success. Does anyone of you use libgd with MS VC++ 200x EE? My problem: It has to to compile with MS Visual C++ (e.g. the 2008 Express Edition - fixed 3rd party condition)... but currently the linker crashes, with 11 of the following LNK2019 errors: Linking... codereate.obj : error LNK2019: An undefined external symbol "_gdImageDestroy" was

PHP/GD, how to copy a circle from one image to another?

别来无恙 提交于 2019-12-12 00:26:19
问题 Is there a reasonably straightforward way to copy a circular area from one image resource to another? Something like imagecopymerge except with circles or ovals etc? If possible, I want to avoid having to use pre-created image files (any oval shape should be possible), and if there's transparency colours involved they should naturally leave the rest of the image alone. Reason I'm asking, I have a few classes that allow to apply image operations inside a "selected area" of an image, which

Centering Image on Uploaded Image in PHP

不羁的心 提交于 2019-12-12 00:14:46
问题 I have users uploading always-square images (of variable dimensions, but always square), and I would like to overlay my own image (also, as it was, a square and of fixed dimensions) in the middle of the square image, regardless of the size. I know I could use GD and play with the dimensions, but is there an way to auto-center it with fewer lines of code? I don't need anything fancy, just an image put into the center of another image. 回答1: I'm confused whether you're asking how to do this in

PHP Water mark script with using GD library function imagejpeg Error

ⅰ亾dé卋堺 提交于 2019-12-11 22:03:14
问题 I have been using the Watermark script used here for creating water mark on image on my site. From last month the images that are being process by this script are not showing. I get the following error in firebug console. Image corrupt or truncated: http://www.mysite.com/data/10.jpg Looking at the error log for server i have this line there PHP Warning: imagejpeg(): Filename cannot be empty in /home/mysite/public_html/data/watermark.php on line 80 Please suggest where the issue is. I checked