PHP/Graphics Image/imagejpeg

Материал из Web эксперт
Версия от 10:05, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Basic image script

   <source lang="html4strict">

<?php

   $image = imagecreate(400,300);
   // do stuff to the image
   imagejpeg($image, "", 75);
   imagedestroy($image);

?>

 </source>
   
  


Loading an Existing Image

   <source lang="html4strict">

<?

   $animage = imagecreatefromjpeg ("images/tiger.jpg")){
   imagejpeg ($animage);
   header ("Content-type: image/jpeg");
   imagedestroy ($animage);

?>

 </source>
   
  


Working with JPGs

   <source lang="html4strict">

<?php

   $animage = imagecreate (200, 200);
   $red = imagecolorallocate ($animage, 255, 0, 0);
   imagerectangle ($animage, 0, 0, 200, 200, $red);
   imagejpeg ($animage);
   header ("Content-type: image/jpeg");
   imagedestroy ($animage);

?>

 </source>