I am working on a new site and would like it to be able to add effects to photos uploaded. (Blur, Pan, Swirl, Sparkle, Border, Frames, etc ) I would like the photo manipulation to be in PHP if possible. I need the user to be able to upload the photo, make the edits, then save the edited photo to their computer.
This may be better as a separate question, but if at all possible I would also like the user to be able to save the edited i开发者_JAVA技巧mage as their Facebook profile image.
Try PHP extensions for ImageMagick It's a standard, tried and true image manipulation library.
From the homepage:
Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
If you consider using the MagickWand PHP extension:
The MagicWand docs start off with a nice PHP code sample shown here:
<?php
$magick_wand=NewMagickWand();
MagickReadImage($magick_wand,'rose.jpg');
$drawing_wand=NewDrawingWand();
DrawSetFont($drawing_wand,"/usr/share/fonts/bitstream-vera/Vera.ttf");
DrawSetFontSize($drawing_wand,20);
DrawSetGravity($drawing_wand,MW_CenterGravity);
$pixel_wand=NewPixelWand();
PixelSetColor($pixel_wand,"white");
DrawSetFillColor($drawing_wand,$pixel_wand);
if (MagickAnnotateImage($magick_wand,$drawing_wand,0,0,0,"Rose") != 0)
{
MagickEchoImageBlob( $magick_wand );
}
else
{
echo MagickGetExceptionString($magick_wand);
}
?>
Similarily, documentation for things you seek:
- blur
- swirl
- frame
- magnify
- and a plethora of others.... On that the main documentation page see all methods listed by searching for the heading: "MagickWand For PHP Methods".
精彩评论