gd

GD library create image with dynamic text on it

一世执手 提交于 2019-12-10 12:17:24
问题 I want to place text generated dynamically from a sql select, on an image created with GD library. I'm using this to create the image and place some text on it, but I want to place the variable $users with the sql select data into the image: $query = "SELECT id, name FROM users WHERE .... ORDER BY id DESC"; while ($line = mysql_fetch_assoc($query)) { $users .= "<img src='https://www.domain.com/" . $line['id'] . "/photo'/> " . $line['name'] . "<br />"; } function create_image(){ $im =

need ideas to only display some pixels and gray out the remaining pixels

可紊 提交于 2019-12-10 11:35:25
问题 I'm looking for ideas ...brainstorming a new project for a client ....I have an image ...300px x 300px ...I need to display the image one random pixel at a time until the entire image is revealed. Basically, at certain intervals, a pixel is revealed and remains revealed while other pixels are still blank. At each interval, another pixel at random is revealed and remains revealed to join the other revealed pixels. Eventually, all the pixels will be revealed. Any suggestions on how to make that

Choosing between Imagemagick & GD for thumbnail creation

蹲街弑〆低调 提交于 2019-12-10 11:28:21
问题 I'm going to write a function for thumbnail creation. I can use both Imagemagick & GD Library methods. Which method creates better thumbnails and is faster and better for server (load, ...)? Thanks 回答1: $im = imagecreatefromjpeg('photo.jpg'); $ox = imagesx($im); $oy = imagesy($im); $nx = 320; $ny = 240; $nm = imagecreatetruecolor($nx, $ny); imagecopyresized($nm,$im,0,0,0,0,$nx,$ny,$ox,$oy); imagejpeg($nm, 't_photo.jpg'); VS exec('convert photo.jpg -resize 320x240 t_photo.jpg'); What do you

PHP resize image proportionally to a bigger size

坚强是说给别人听的谎言 提交于 2019-12-10 11:24:04
问题 I'm currently working on a script that shows thumbnails from a website on a mobile app, and I'm having problems with the "retina display". If the original image is big enough, I show a thumbnail with the double of the required size, and if it is not, I show it on the required size. Now, my function checks if it can be resized proportionally and if it can't, I resize it to the "min-width" or "min-height" and crop it from the center. Here is the problem: if it detects that the image can't be

print quality images with php and GD

限于喜欢 提交于 2019-12-10 10:26:06
问题 I need to take a photo someone has uploaded through a form, resize, merge with a high-res frame @ 300dpi and keep it all @ 300dpi for the best quality for print. is it possible to handle high-res images through GD and if so, could you provide some information on how? I have code that already does the resizing and merging, but i'm not sure if its going to work at the correct dpi. Thanks 回答1: It's basically possible: Just use the proper amount of pixels. (The dpi unit has no meaning in digital

Place image in another image with PHP

你说的曾经没有我的故事 提交于 2019-12-10 10:23:49
问题 I have an image on which the text is being dynamically generated via a php form. I have the location of a logo image saved to a variable from a mysql database. Is there a way to take this image and apply it to a fixed position in the image? If need be, it will have to be resized smaller to fit in this image area. I already have a script that looks like this: $img = imagecreatefromjpeg('coupon/coupontemplate.jpg'); $textColor = imagecolorallocate($img, 0, 0, 0); // black text //Write first the

Unable to create GD image resource from BMP with MIME type 'image/x-ms-bmp' in PHP

筅森魡賤 提交于 2019-12-10 10:09:33
问题 I'm trying to create a GD image resource from a BMP image, however I'm having no luck. The BMP image in question was created and saved with Photoshop. I've tried a couple of BMPs I found on the web too, and they gave the same results. getimagesize() tells me the BMP image has an image type of IMAGETYPE_BMP (6) and a MIME type of 'image/x-ms-bmp'. I've tried running the image through imagecreatefromwbmp() and imagecreatefromxbm(), but neither recognise it. I've also tried running it through

PHP - imagettftext not working and GD installed

偶尔善良 提交于 2019-12-10 03:43:46
问题 It's being long hours that I'm still looking for answer to this problem.. All the solutions I find are around catching the font name but I am pretty sure this isn't my problem. It looks like GD is installed array(11) { ["GD Version"]=> string(27) "bundled (**2.0.34 compatible**)" ["FreeType Support"]=> bool(false) ["T1Lib Support"]=> bool(false) ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(true) ["JPEG Support"]=> bool(true) ["PNG Support"]=> bool(true) ["WBMP Support"]=>

I can't open this PNG file with imagecreatefrompng()

非 Y 不嫁゛ 提交于 2019-12-10 03:39:36
问题 Here is a PNG file: http://imgur.com/NUl4v.png (Yes, never mind that it's a funny penguin with a sign...) When running the following code: imagecreatefrompng('http://imgur.com/NUl4v.png'); I get an error: PHP Warning : imagecreatefrompng() [function.imagecreatefrompng] : Cannot read image data in /home/test/... The PNG file seems to be fine - I can open it with different editors, and the Unix file command reports that it is: PNG image, 640 x 360, 8-bit/color RGB, non-interlaced PHP version: 5

Amazon EC2 - PHP GD image library

橙三吉。 提交于 2019-12-10 01:48:20
问题 I've got a brand new install of WordPress setup and activated a custom-built theme along with a good amount of plugins. In the posts, I have built it so the user can create a post, upload an image as a thumbnail and it will automatically resize the image to a custom size set in my functions.php file. All this has been working on my local end (MAMP) correctly but when I tried making everything work on our Amazon EC2 server, the images do not resize to the size set. They resize by actual code