PHP Classes

File: esempio.php

Recommend this page to a friend!
  Classes of StefanoV89   Thumb And Crop   esempio.php   Download  
File: esempio.php
Role: Example script
Content type: text/plain
Description: example file
Class: Thumb And Crop
Generate and crop image thumbnails
Author: By
Last change: Added call function resetOriginal
Date: 15 years ago
Size: 966 bytes
 

Contents

Class file image Download
<?php

   
// includo la classe
   
require_once("libs/thumbncrop.inc.php");
   
   
// valorizzo la variabile
   
$tb = new ThumbAndCrop();
   
   
// apro l'immagine
   
$tb->openImg("ghi.jpg");
   
   
// ottengo l'altezza proporzionata ad una lunghezza di 100px
   
$newHeight = $tb->getRightHeight(100);
   
   
// creo la miniatura con le dimensioni da me volute
   
$tb->creaThumb(100, $newHeight);
   
   
// abilito il ThumbAndCrop
   
$tb->setThumbAsOriginal();
   
   
// taglio l'img a dimensione 100x50 artendo dalla thumb x:0, y:20
   
$tb->cropThumb(100, 50, 0, 20);
   
   
// stampo a video l'immagine ottenuta
   
$tb->printThumb();
   
   
// salvo l'immagine nel file cropthumb.jpg
   
$tb->saveThumb("cropthumb.jpg");
   
   
// resetto l'immagine
   
$tb->resetOriginal();
   
   
// ricreo la miniatura con le dimensioni da me volute
   
$tb->creaThumb(100, $newHeight);
   
   
// salvo la miniatura come thumb.jpg
   
$tb->saveThumb("thumb.jpg");
   
   
// chiudo le immagini
   
$tb->closeImg();
   
?>