<?
function resize_jpg($img,$w,$h){// $thumb = imagecreate ($w, $h);
$image = ImageCreateFromJpeg($img); $imagedata = getimagesize($img);
if ($h = "auto") $h = $w/($imagedata[0]/$imagedata[1]);//根据原图的纵横比得出高度!
$thumb = imagecreatetruecolor ($w, $h);imagecopyresized ($thumb, $image, 0, 0, 0, 0, $w, $h, $imagedata[0], $imagedata[1]);imagejpeg($thumb);}//resize_jpg($file,$W,$H);
resize_jpg("images/DSC01244.JPG",100,100);
imagedestory($thumb);
imagedestory($image);
?>以上是我自己做的一个自动做缩略图的代码!!!
function resize_jpg($img,$w,$h){// $thumb = imagecreate ($w, $h);
$image = ImageCreateFromJpeg($img); $imagedata = getimagesize($img);
if ($h = "auto") $h = $w/($imagedata[0]/$imagedata[1]);//根据原图的纵横比得出高度!
$thumb = imagecreatetruecolor ($w, $h);imagecopyresized ($thumb, $image, 0, 0, 0, 0, $w, $h, $imagedata[0], $imagedata[1]);imagejpeg($thumb);}//resize_jpg($file,$W,$H);
resize_jpg("images/DSC01244.JPG",100,100);
imagedestory($thumb);
imagedestory($image);
?>以上是我自己做的一个自动做缩略图的代码!!!
ftp://ftp.imagemagick.org/pub/ImageMagick/
下载后php中用system函数调用
system("$convert_path"."convert -geometry $ImgWidth $imgname $outimg_name");安装时ImageMagick路径中最好不要有空格
下面是他的帮助这个东西可以处理绝大多数图像,最好用了
Version: ImageMagick 5.5.7 05/23/03 Q8 http://www.imagemagick.org
Copyright: Copyright (C) 2003 ImageMagick Studio LLCUsage: convert.exe [options ...] file [ [options ...] file ...] [options ...] fi
leWhere options include:
-adjoin join images into a single multi-image file
-affine matrix affine transform matrix
-antialias remove pixel-aliasing
-append append an image sequence
-authenticate value decrypt image with this password
-average average an image sequence
-background color background color
-black-threshold value
forces all pixels below the threshold into black
-blue-primary point chomaticity blue primary point
-blur geometry blur the image
-border geometry surround image with a border of color
-bordercolor color border color
-channel type extract a particular color channel from image
-charcoal radius simulate a charcoal drawing
-chop geometry remove pixels from the image interior
-clip apply clipping path if the image has one
-coalesce merge a sequence of images
-colorize value colorize the image with the fill color
-colors value preferred number of colors in the image
-colorspace type alternate image colorspace
-comment string annotate image with comment
-compress type image compression type
-contrast enhance or reduce the image contrast
-convolve coefficients
apply a convolution kernel to the image
-cycle amount cycle the image colormap
-debug events display copious debugging information
-deconstruct break down an image sequence into constituent parts
-delay value display the next image after pausing
-density geometry horizontal and vertical density of the image
-depth value image depth
-despeckle reduce the speckles within an image
-display server get image or font from this X server
-dispose method Undefined, None, Background, Previous
-dither apply Floyd/Steinberg error diffusion to image
-draw string annotate the image with a graphic primitive
-edge radius apply a filter to detect edges in the image
-emboss radius emboss an image
-encoding type text encoding type
-endian type LSB or MSB
-enhance apply a digital filter to enhance a noisy image
-equalize perform histogram equalization to an image
-extract geometry extract area from image
-fill color color to use when filling a graphic primitive
-filter type use this filter when resizing an image
-flatten flatten a sequence of images
-flip flip image in the vertical direction
-flop flop image in the horizontal direction
-font name render text with this font
-frame geometry surround image with an ornamental border
-fuzz distance colors within this distance are considered equal
-gamma value level of gamma correction
-gaussian geometry gaussian blur an image
-geometry geometry perferred size or location of the image
-green-primary point chomaticity green primary point
-gravity type horizontal and vertical text placement
-help print program options
-implode amount implode image pixels about the center
-intent type Absolute, Perceptual, Relative, or Saturation
-interlace type None, Line, Plane, or Partition
-label name assign a label to an image
-lat geometry local adaptive thresholding
-level value adjust the level of image contrast
-limit type value Disk, Map, or Memory resource limit
-list type Color, Delegate, Format, Magic, Module, Resource, or Type -log format format of debugging information
-loop iterations add Netscape loop extension to your GIF animation
-map filename transform image colors to match this set of colors
-mask filename set the image clip mask
-matte store matte channel if the image has one
-median radius apply a median filter to the image
-modulate value vary the brightness, saturation, and hue
-monochrome transform image to black and white
-morph value morph an image sequence
-mosaic create a mosaic from an image sequence
-negate replace every pixel with its complementary color
-noop do not apply options to image
-noise radius add or reduce noise in an image
-normalize transform image to span the full range of colors
-opaque color change this color to the fill color
-ordered-dither channeltype LOWxHIGH
ordered dither the image
-page geometry size and location of an image canvas
-paint radius simulate an oil painting
-ping efficiently determine image attributes
-pointsize value font point size
-preview type image preview type
-profile filename add ICM or IPTC information profile to image
-quality value JPEG/MIFF/PNG compression level
-raise value lighten/darken image edges to create a 3-D effect
-random-threshold channeltype LOWxHIGH
random threshold the image
-region geometry apply options to a portion of the image
-raise value lighten/darken image edges to create a 3-D effect
-red-primary point chomaticity red primary point
-render render vector graphics
-resize geometry resize the image
-resample geometry change the resolution of an image
-roll geometry roll an image vertically or horizontally
-rotate degrees apply Paeth rotation to the image
-sample geometry scale image with pixel sampling
-sampling-factor geometry
horizontal and vertical sampling factor