views:

39

answers:

1
+1  Q: 

PHP Photo Effects

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 image as their Facebook profile image.

+3  A: 

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:

John K
I love ImageMagick, especially MagickWand so far, but can't figure out how to install it to my server. I have purchased hosting from a company (mrpuma.com) that provide CPanel hosting. Any ideas?
Zachary Brown
I have no ideas off the top of my head. However you might get good feedback if you reformulate it as another question, maybe as a server issue on companion site http://serverfault.com/
John K