gd

How to properly resize large images in PHP

For a website I run, users can upload pictures they've drawn to a gallery. We create a thumbnail and a small view of that image to display to other users (clicking the small view image shows the full sized image). With this in mind, I created a very simple resize script. In most cases this script works perfectly. However, I've come a...

JPG files processing problem (GD library, timthumb) - created of bad quality

I'm using the latest version of timthumb for creating thumbnails of the images on the fly. My local server for development is on Windows Vista, Apache 2.2, php 5.2.13, gd library is enabled with full support: GD Support enabled GD Version bundled (2.0.34 compatible) FreeType Support enabled FreeType Linkage with freetype FreeType Vers...

php gd and text

Hi, Is it possible the saved text with different styles and colors in the image? ...

php, gd and style

Hi, for example i have this html code: <p><strong>Text text.</strong></p> <p><span style="font-size: 14pt;"><span style="background-color: #ff0000;">Text text...</span></span></p> Possible write this text with this style on the image (with php GD)? Thanks ...

GD Captcha Generator in C

I'm writing a fastcgi app for my website in C. How do I use GD to generate a CAPTCHA image? I searched for some stuff on google in vain (still search is going on), but it would be nice if someone could give me the basic idea about the procedure. For random numbers, I will use nanoseconds as seed (or use that itself). Thanks in advanc...

Recommendation for real time image processing tools on Linux

Hi, I'm trying to find a real time image processing tool that can do image resizing, image/text overlaying and format converting. I found some related posts but they don't quite answer my question. Prioritized criteria for the tool: The processing time needs to be less than 100 ms. The size of output image needs to be small. It needs...

Should I install Imagmagick over gd

I'm starting to work on a project that will require a lot of image manipulation. I remember getting the impression in the past that imagemagick was somehow better than GD. Since I have GD only, this will require me to install imagemagick, and I want to make sure it's worth the trouble. Can someone clarify if it's true that imagemagick ...

PHP JPEG Functions Not Working

Any PHP functions that deal with JPEGs don't seem to be working on my server. This code: <?php $im = imagecreatetruecolor(120, 20); $text_color = imagecolorallocate($im, 233, 14, 91); imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color); header('Content-type: image/jpeg'); imagejpeg($im); imagedestroy($im); ?> creates an e...

Serving images via `print fread(...)` is slow, what to do?

I have a dynamic thumbnail script I found laying around the web and tweaked a bit. One of the things I added was a caching mechanism. Whenever a new thumb is generated, it is saved to disk, and the disk copy will be used if the same thumbnail (with all the same options) is requested again. A snippet: // name of cached file $thumb_...

PHP GD Trim Transparent Pixels from created PNG

I am currently working on a website and lately have been using GD with PHP to automatically create transparent images that consist of text for use with navigation, headers, etc on the website. It saves me a lot of time in Photoshop plus I can change the text on the buttons instantly when needed. Well I have hit a dead end here. I foun...

PHP GD: Blur for transparent image

Hello world. I am trying to create the silhouette of PNG image with transparencies. Here is my code //file that i am working with $file='http://www.google.com/mapfiles/turkey.png'; $im =imagecreatefrompng($file); imagealphablending($im, false); imagesavealpha($im, true); $imw =imagesx($im); $imh =imagesy($im); //turkey body ...

Simulate Photoshop's Multiply in PHP with gd or ImageMagick

Having until now only used PHP's gd image library to resize, crop and greyscale images I'm currently struggling to find a way to simulate what happens when, in Photoshop, you place a coloured layer over a greyscale image and select 'multiply' from the layer effects menu. Or, as my old print lecturer would explain it, I need to make a duo...

Algorithm that find the percent of color in a gradient image

Hi all. I want to know how to find the percent of color in a gradient image with library GD of php. Please help me ...

Trouble with imagepng

I am struggling with PHP's GD library. I have written a script called foo.php which outputs a png: header('Content-type:image/png'); $img = imagecreatefrompng($url) or die('bad url:'.$url); imagepng($img); imagedestroy($img); It works fine. Its purpose is to accept a GET parameter and then spit out the appropriate graph: (e.g.) fo...

How to get the rgb colors from an already allocated color in PHP GD

How would you get the colors from an allocated color something like... $col = imagecolorallocate($im, 255, 50, 5); //A fake function - rgbfromallocate (that I wish I knew) $rgb = rgbfromallocate($col); print $rgb['r'];//255 print $rgb['g'];//50 print $rgb['b'];//5 ...

PHP GD leech with watermark

I was wondering if someone can provide me with a tutorial or source code of a way to make it so if people are leeching my sites images and embedding them in their forums or sites it will show a watermark, but if they view it on my site their wont be a watermark? ...

Dynamic Image Generating in PHP from content

Hi All, i want to know how can i generate image dynamically from content and also from existing image as i know we can add sting to dynamically generated image in php so actually i want to make image that contains existing image as well as content. ...

How to delete transparent color in images?

What is the best way to replace transparent colors with white in gif and png images with php? // get transparent color indexes $trsp = ImageColorsForIndex($image, ImageColorTransparent($image)); // get transparent color set $delete = imagecolorallocate($image, $trsp['red'], $trsp['green'], $trsp['blue']); // replace imagecolorset($imag...

Perspective transformation with GD

How could you distort an image with PHP GD from this... To this... using only the PHP GD library. I don't want to use a function someone else made I want to UNDERSTAND what's going on ...

Draw a star using imagefilledpolygon (with diagram)

Is there a way with PHP GD to draw a star using imagefilledpolygon? Where would the points be plotted? I believe it involves sine and cosine because... How can I relate those points to the center using sine and cosine in GD? ...