PHP Classes

File: example4.php

Recommend this page to a friend!
  Classes of Vagharshak Tozalakyan   Image Batch Processor   example4.php   Download  
File: example4.php
Role: Example script
Content type: text/plain
Description: Example of processing the whole directory with some exceptions
Class: Image Batch Processor
Apply graphical operations on a set of image files
Author: By
Last change:
Date: 15 years ago
Size: 751 bytes
 

Contents

Class file image Download
<?php

set_time_limit
(600);

require_once
'class.ImageBatchProcessor.php';

$ibp = new ImageBatchProcessor();

$t = new ImageBatchTransformation();
$t->source = 'c:/mypicts/album1/';
$t->destination = 'd:/album/';
$t->format = TI_JPEG;
$t->jpegQuality = -1;
$t->interlace = TI_INTERLACE_ON;
$t->maxWidth = 150;
$t->maxHeight = 150;
$t->fitToMax = false;
$t->replaceExisted = true;

// Process all JPEGs from the directory except mypict.jpg.
$n = $ibp->process($t, '/^(?!mypict.jpg$)(.*)(\.jpg)$/is');

$t->source = 'c:/mypicts/album1/mypict.jpg';
$t->destination = 'd:/album/mypict.jpg';
$t->rotateAngle = -90;

// Rotate and process mypict.jpg.
$n += $ibp->processEx(array($t));

printf('%d images processed.', $n);

?>