You know, maybe this goes without saying, but I thought I would drop a note in here. When developing code to resize images, it is best not to use GD. When using the current GD methodologies, you are reading content from an image and manipulating it. By then writing that content to a brand new file, you are losing the EXIF data.
For purposes when you want to retain EXIF data, it is recommended that you compile in and use the PECL Imagick extension. It has great resizing methods built right in and the EXIF data is retained.
Image Processing (GD)
- Introducción
- Installing/Configuring
- Constantes predefinidas
- Ejemplos
- GD Functions
- gd_info — Retrieve information about the currently installed GD library
- getimagesize — Obtener el tamaño de una imagen
- image_type_to_extension — Get file extension for image type
- image_type_to_mime_type — Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype
- image2wbmp — Output image to browser or file
- imagealphablending — Set the blending mode for an image
- imageantialias — Should antialias functions be used or not
- imagearc — Dibuja una elipse parcial
- imagechar — Dibuja un carácter horizontalmente
- imagecharup — Dibuja un carácter vertical
- imagecolorallocate — Reserva un color para una imagen
- imagecolorallocatealpha — Allocate a color for an image
- imagecolorat — Obtiende el índice del color de un pixel
- imagecolorclosest — Obtiene el índice del color más cercano al color especificado
- imagecolorclosestalpha — Get the index of the closest color to the specified color + alpha
- imagecolorclosesthwb — Get the index of the color which has the hue, white and blackness
- imagecolordeallocate — De-allocate a color for an image
- imagecolorexact — Devuelve el índice del color especificado
- imagecolorexactalpha — Get the index of the specified color + alpha
- imagecolormatch — Makes the colors of the palette version of an image more closely match the true color version
- imagecolorresolve — Devuelve el índice del color especificado o su posible alternativa más cercana
- imagecolorresolvealpha — Get the index of the specified color + alpha or its closest possible alternative
- imagecolorset — Establece el color para el índice de la paleta especificado
- imagecolorsforindex — Obtiene los colores de un índice
- imagecolorstotal — Encuentra el número de colores de la paleta de una imagen
- imagecolortransparent — Define un color como transparente
- imageconvolution — Apply a 3x3 convolution matrix, using coefficient and offset
- imagecopy — Copy part of an image
- imagecopymerge — Copy and merge part of an image
- imagecopymergegray — Copy and merge part of an image with gray scale
- imagecopyresampled — Copia y reescala parte de una imagen con remuestreo
- imagecopyresized — Copia y redimensiona parte de una imagen
- imagecreate — Crea una nueva imagen con una paleta de colores
- imagecreatefromgd2 — Create a new image from GD2 file or URL
- imagecreatefromgd2part — Create a new image from a given part of GD2 file or URL
- imagecreatefromgd — Create a new image from GD file or URL
- imagecreatefromgif — Crear una nueva imagen a partir de un archivo o URL
- imagecreatefromjpeg — Crea una imagen nueva desde un archivo o URL
- imagecreatefrompng — Crea una imagen nueva desde un archivo o URL
- imagecreatefromstring — Create a new image from the image stream in the string
- imagecreatefromwbmp — Create a new image from file or URL
- imagecreatefromxbm — Create a new image from file or URL
- imagecreatefromxpm — Create a new image from file or URL
- imagecreatetruecolor — Crea una imagen nueva en color real (true color)
- imagedashedline — Dibuja una línea discontinua
- imagedestroy — Destruye una imagen
- imageellipse — Draw an ellipse
- imagefill — Rellena de color
- imagefilledarc — Draw a partial arc and fill it
- imagefilledellipse — Draw a filled ellipse
- imagefilledpolygon — Dibuja un polígono relleno
- imagefilledrectangle — Dibuja un rectángulo relleno
- imagefilltoborder — Relleno de un color especifico
- imagefilter — Applies a filter to an image
- imagefontheight — Devuelve la altura de una fuente
- imagefontwidth — Devuelve la anchura de una fuente
- imageftbbox — Give the bounding box of a text using fonts via freetype2
- imagefttext — Write text to the image using fonts using FreeType 2
- imagegammacorrect — Apply a gamma correction to a GD image
- imagegd2 — Output GD2 image to browser or file
- imagegd — Output GD image to browser or file
- imagegif — Producir la salida de una imagen al navegador o a un archivo
- imagegrabscreen — Captures the whole screen
- imagegrabwindow — Captures a window
- imageinterlace — Activa o desactiva el entrelazado
- imageistruecolor — Finds whether an image is a truecolor image
- imagejpeg — Output image to browser or file
- imagelayereffect — Set the alpha blending flag to use the bundled libgd layering effects
- imageline — Dibuja una línea
- imageloadfont — Cargar una fuente nueva
- imagepalettecopy — Copy the palette from one image to another
- imagepng — Output a PNG image to either the browser or a file
- imagepolygon — Dibuja un polígono
- imagepsbbox — Entregar la cada circundante de un rectángulo de texto usando fuentes PostScript Type1
- imagepsencodefont — Modificar el vector de codificación de caracteres de una fuente
- imagepsextendfont — Extend or condense a font
- imagepsfreefont — Liberar memoria usada por una fuente PostScript Type 1
- imagepsloadfont — Cargar una fuente PostScript Tipo 1 desde un archivo
- imagepsslantfont — Slant a font
- imagepstext — Dibuja un texto sobre una imagen usando fuentes PostScript Type1
- imagerectangle — Dibujar un rectángulo
- imagerotate — Rotate an image with a given angle
- imagesavealpha — Set the flag to save full alpha channel information (as opposed to single-color transparency) when saving PNG images
- imagesetbrush — Set the brush image for line drawing
- imagesetpixel — Definir un pixel individual
- imagesetstyle — Set the style for line drawing
- imagesetthickness — Set the thickness for line drawing
- imagesettile — Set the tile image for filling
- imagestring — Dibujar una cadena horizontalmente
- imagestringup — Dibujar una cadena verticalmente
- imagesx — Obtener el ancho de una imagen
- imagesy — Obtener la altura de una imagen
- imagetruecolortopalette — Convert a true color image to a palette image
- imagettfbbox — Entrega la caja circundante de un texto usando fuentes TrueType
- imagettftext — Escribir un texto sobre la imagen usando fuentes TrueType
- imagetypes — Return the image types supported by this PHP build
- imagewbmp — Output image to browser or file
- imagexbm — Output XBM image to browser or file
- iptcembed — Embed binary IPTC data into a JPEG image
- iptcparse — Parse a binary IPTC block into single tags.
- jpeg2wbmp — Convert JPEG image file to WBMP image file
- png2wbmp — Convert PNG image file to WBMP image file
GD
Thomas
10-Dec-2008 02:05
10-Dec-2008 02:05
chocobo_bu at hotmail dot com
23-Oct-2008 09:07
23-Oct-2008 09:07
If you want to merge gif animate you must split image to multiple frame and merge it frame by frame.
Finally you just merge multiple frame back to gif animate it completed. :)
learn more about this case
http://www.myfineday.com/2008/10/02/php-how-to-merge-gif-animate/
code at ashleyhunt dot co dot uk
23-Oct-2008 06:02
23-Oct-2008 06:02
I have been looking to send the output from GD to a text string without proxying via a file or to a browser.
I have come up with a solution.
This code buffers the output between the ob_start() and ob_end() functions into ob_get_contents()
See the example below
<?php
// Create a test source image for this example
$im = imagecreatetruecolor(300, 50);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
// start buffering
ob_start();
// output jpeg (or any other chosen) format & quality
imagejpeg($im, NULL, 85);
// capture output to string
$contents = ob_get_contents();
// end capture
ob_end_clean();
// be tidy; free up memory
imagedestroy($im);
// lastly (for the example) we are writing the string to a file
$fh = fopen("./temp/img.jpg", "a+" );
fwrite( $fh, $contents );
fclose( $fh );
?>
Enjoy!
Ashley
