📜 ⬆️ ⬇️

Making Web Dvd Previews with ImageMagick

Recently, I had a problem with GD on the server - it stopped understanding png, after half an hour of ordeal, I decided to look at ImageMagick and its PHP interface IMagick
After a short googling I found a wonderful blog dedicated to Imagick. I also found a way to make beautiful thumbnails. However, the method proposed there, correctly worked out only with png pictures. I did some digging and made my own.

Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  1. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  2. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  3. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  4. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  5. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  6. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  7. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  8. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  9. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  10. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  11. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  12. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  13. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  14. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  15. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  16. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  17. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  18. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  19. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  20. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  21. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  22. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  23. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  24. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  25. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  26. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  27. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  28. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  29. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  30. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  31. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  32. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>
  33. Copy Source | Copy HTML <?php $thumb = new Imagick(); // $thumb ->readImage( $fullpath ) // $canvas = new Imagick(); $canvas ->newImage( $width , $height , new ImagickPixel( "white" )); // , , , $thumb ->thumbnailImage( $width - 10 , $height - 10 ); // , if ( $width < 300 ) $thumb ->sharpenImage( 4 , 1 ); // $thumb ->roundCorners( 5 , 5 ); // , $shadow = $thumb -> clone (); // $shadow ->setImageBackgroundColor( new ImagickPixel( 'black' )); //, $shadow ->shadowImage( 80 , 2 . 5 , 5 , 5 ); // 98798798999999999999 $canvas ->compositeImage( $shadow , $shadow ->getImageCompose(), 0 , 0 ); // $canvas ->compositeImage( $thumb , $thumb ->getImageCompose(), 0 , 0 ); // .. $canvas ->stripImage(); // $canvas ->writeImage( $writeTo ); // $canvas ->destroy(); $shadow ->destroy(); $thumb ->destroy(); ?>

As a result, we get something like this;):
490704de9e6b9.jpg - image uploaded to Picamatic
upd: the same with Russian comments http://bin.cakephp.org/view/906967763

')

Source: https://habr.com/ru/post/43511/


All Articles