gd

Good Image Resizing Framework

Hi, I'm currently resizing images in PHP, and my current code takes about 2-2.2 seconds (not including upload time) to resize an image to two sizes, one thumbnail size, and one medium-sized. Can anyone recommend a framework or class that I could download that would resize the images quickly? Thanks. ...

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

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 le...

Translucent Image Reflection in PHP GD

Alright, I've been hacking around with GD Image for a couple of months, and a task that I wanted to accomplish with it was to create a script that takes an existing image, and then creates a reflection that fades out to translucent beneath it. The following guide shows how to do it with an opaque color : TalkPHP Forums Link In that fo...

A fail-safe way to prevent GD image library from running out of memory? (PHP)

Is there a way to prevent the PHP GD image library from running out of memory? If too large an image is uploaded, GD tends to run out of memory, terminating the script. I'd like it to throw a catchable exception or something to that extend, but alas it doesn't. Right now I'm using a cobbled-together script that first issues an ini_set('...

im trying to figure out how to write a gd class that will display a string in any font type i input.

here is the class i have so far <?php class txt2img { var $image; var $headertype; var $forecolor; var $fontsize; var $fontangle; var $font; var $string; //font size function fontsize($fontsize) { return $this->fontsize; } //forecolor function forecolor($forecolor) { return this->imagecolorallocate($this->img(),$this->forec...

Warning: imageftbbox() [function.imageftbbox]: Problem loading glyph - what is this error

I got this error on my image generation script : Warning: imageftbbox() [function.imageftbbox]: Problem loading glyph: I think because of this I can't generate images from text properly - how do I fix this! ...

What is the difference between ImageMagick and libGD?

I don't know anything about either library but I have to choose one of them. Which one whould you recommend? I'm using Perl. I need to generate images for weather site. The image is generated for a location and should contain temperature and a weather condition image inside. I guess this is a piece of cake for both libs. But I want to k...

How can I create a screenshot of a http website and save it on my server?

How can I create a screenshot of an http website and save it on my server, using dot.net byte[] byteArray = Encoding.ASCII.GetBytes( resp.BodyStr ); MemoryStream stream = new MemoryStream( byteArray ); pictureBox1.Image = Image.FromStream(stream); stream.Close(); I have tried the above code but it's n...

Transparency with background image using GD

Using GD2 to fill in a transparent png with a solid colour, here is my code and the result. Basically as soon as the transparency begins, the fill colour stops abruptly instead of blending in with the transparency. private function GenerateImage() { $original = imagecreatefrompng($this->ImagePath()); $x = imagesx($original); $y = im...

trying to understand something about php gd

if i have something like this <?php $image = imagecreate(300,20); $background = imagecolorallocate($image,0,0,0); $foreground = imagecolorallocate($image,255,255,255); imagestring($image,5,5,1,'sarmenhb, $foreground); header('Content-type: image/jpeg'); imagejpeg($image); ?> how does php know the first imagecolorallocate function wi...

image merging using php in GD

hi i want to merge two images in php using GD how can i do this ? ...

GD Image library: Range of colour component arguments for TrueColor images

I'm trying to output a TrueColor image using GD (specifically bgd.dll) from a C++ program under windows. The API (or at least the examples) seem to suggest that the range of the integer RGB arguments for gdResolveColor spans the values 0-255. Is this correct? I've experimented with higher values and gotten strange results but this coul...

Render the square wave form graph using PHP

I would like to render the square wave form of graph using the only values of zero and one on certain time intervals. I used fusion chart line graph to render the chart but when the values changes from zero to one the line goes very slanting but i would like to show it straight. For example check out the attached image it shows the s...

PHP GD: How to get imagedata as binary string?

I'm using a solution for assembling image files to a zip and streaming it to browser/Flex application. (ZipStream by Paul Duncan, http://pablotron.org/software/zipstream-php/). Just loading the image files and compressing them works fine. Here's the core for compressing a file: // Reading the file and converting to string data $stringd...

How to set proper colors in a GD image in PHP?

I am working on a captcha image type script and I am wanting to alternate each letters color on my image, so far I have it working pretty much except the color values are not what I expected The colors in this $multi_text_color variable should be the colors that it randomly picks and shows, it does work in randomly picking the color arr...

How can I add an image onto an image in PHP like a watermark

I am trying to write a small php function to take an image and apply a watermark type image on top of the image and them save them as 1 image, this code runs with 0 errors but does not apply the watermark image, is there anything obvious that stants out on why it won't? <?PHP $source_file_path ='http://cache2.mycrib.net/images/image_gro...

Find the most common colour in an image

Or color for you American fools! ;) How can I use PHP to find the most common colour in an image? ...

GD - rotating image doesn't work in IE and Opera

I've created a function that rotates defined image. It works perfect in firefox, but in IE and Opera nothing happens - the image is reloaded but not rotated. Does anybody know why? Here goes the code: function rotateImage($direction, $id, $angle) { $dir = opendir($direction); if ($img = imagecreatefromjpeg($_SESSION['files'][$id]['lar...

php: take a thumbnail from a quicktime (movie) file

Does someone know if it's even possible (in PHP) to take a frame/thumbnail from a quicktime movie on the server? Something like the usual GD thumbnail generation, but for .mov files. thanks! note: I'm using dreamhost, so I don't have more than web-panel access to the server. ...

PHP/GD Gaussian Blur Effect

I need to obfuscate a certain area of an image using PHP and GD, currently I'm using the following code: for ($x = $_GET['x1']; $x < $_GET['x2']; $x += $pixel) { for ($y = $_GET['y1']; $y < $_GET['y2']; $y += $pixel) { ImageFilledRectangle($image, $x, $y, $x + $pixel - 1, $y + $pixel - 1, ImageColorAt($image, $x, $y)); ...