PHP/Graphics Image/JPG Image

Материал из Web эксперт
Перейти к: навигация, поиск

Load jpg image file

   <source lang="html4strict">

<?php $myImage = imagecreatefromjpeg("jpgFile.jpg"); header("Content-type: image/jpeg"); imagejpeg($myImage); imagedestroy($myImage); ?>

      </source>
   
  


Paint on a jpg image file

   <source lang="html4strict">

<?php $mainImage = imagecreatefromjpeg("jpgFile.jpg"); $mainWidth = imagesx($mainImage); $mainHeight = imagesy($mainImage); $thumbWidth = intval($mainWidth / 4); $thumbHeight = intval($mainHeight / 4); $myThumbnail = imagecreatetruecolor($thumbWidth, $thumbHeight); imagecopyresampled($myThumbnail, $mainImage, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $mainWidth, $mainHeight); header("Content-type: image/jpeg"); imagejpeg($myThumbnail); imagedestroy($myThumbnail); imagedestroy($mainImage); ?>

      </source>