Convertire un file PSD con PHP!

Posted on 18. Jan, 2010 by daniele in php, tutorials


L'estensione PHP imagick è davvero sorprendente. E' possibile aggiungere effetti, ruotare un'immagine, convertire e qualsiasi altra manipolazione si possa immaginare! Nell'esempio che vedete qui sotto vi mostriamo com'è possibile convertire un file PSD in immagine PNG.

 
< ?php
 
  /*** the image name ***/
  $image = 'my.psd';
 
  /*** read the image into imagick ***/
  $im = new Imagick( $image );
 
  /*** convert to png ***/
  $im->setImageFormat('png');
 
  /*** thumbnail the image ***/
  $im->thumbnailImage( 200, null );
 
  /*** set the correct header ***/
  header( "Content-Type: image/png" );
 
  /*** display the image ***/
  echo $im;
?>
 

Correlati

Leave a reply