Class ImageSizer

Description

$Id: ImageSizer.php 65 2007-01-20 01:50:30Z thepaper $

ImageSizer.php - resize standard web image (gif/jpg/png)

  • author:

    Jack Pham (www.reversefolds.com) copyright (c) 2006

    License and Terms: This software is provided AS-IS with no explicit or implied warranties or garantees whatsoever. USE AT OWN RISK. The original author, hosting provider and anyone/everyone he knows is NOT LIABLE for any damages incurred using, downloading or looking at this this software.

    Please send any bugfixes/modifications to jack@reversefolds.com

    ======================================

    Usage:

    // create a thumbnail file in images/pics/thumbs/ dir
    // (dir created if it doesn't exist) with set width
    $image = new ImageSizer('pic.gif', 'images/pics/', 75);
    $thumbnail = $image->getThumbnail();
    // 'images/pics/thumbs/th_pic.gif'

    // set the height
    $image = new ImageSizer('pic.gif', 'images/', 'auto', 150);

    // size by percentage (75%)
    $image = new ImageSizer('pic.gif', 'images/', 'auto', 'auto', 0.75);

    // create a sub directory under thumbs
    $image->setSubDir('mythumbs');

    // place thumbs in user-defined directory (instead of the default 'thumbs'
    $image->setOutputDir('thumbdir'); =======================================

Located in ImageSizer.php (line 42)


	
			
Method Summary
ImageSizer ImageSizer (string $file, string $path, [optional $width = 'auto'], [optional $height = 'auto'], [optional $percentage = 'auto'])
string getThumbnail ()
void setOutputDir (mixed $outputDir, string $outputDir )
void setPrefix (string $prefix)
void setQuality (mixed $quality, int $quality )
void setSubDir (string $dir)
void setThumbDir (string $dir)
Methods
Constructor ImageSizer (line 126)

constructor - sets original width/height

ImageSizer ImageSizer (string $file, string $path, [optional $width = 'auto'], [optional $height = 'auto'], [optional $percentage = 'auto'])
  • string $file: image file name
  • string $path: path to image
  • optional $width: int $width
  • optional $height: int $height
  • optional $percentage: float $percentage of size change
getThumbnail (line 155)

create thumbnail

  • return: path to thumbnail
string getThumbnail ()
setOutputDir (line 230)

set thumbnail output directory - defaults to 'thumbs'

void setOutputDir (mixed $outputDir, string $outputDir )
  • string $outputDir
setPrefix (line 248)

set filename prefix for thumbnails

void setPrefix (string $prefix)
  • string $prefix: thumbnail prefix
setQuality (line 212)

set jpeg quality

void setQuality (mixed $quality, int $quality )
  • int $quality
setSubDir (line 221)

set sub directory to place thumbnails in (created under 'thumbs' dir)

void setSubDir (string $dir)
  • string $dir: directory
setThumbDir (line 239)

set thumbnail main sub directory

void setThumbDir (string $dir)
  • string $dir: thumbnail sub directory name

Documentation generated on Sun, 21 Jan 2007 22:44:34 -0600 by phpDocumentor 1.3.0RC3

BACK TO TOP