NetpbmResize
[ class tree: NetpbmResize ] [ index: NetpbmResize ] [ all elements ]

Class: NetpbmResize

Source Location: /netpbmresize.class.php

Class Overview


NetpbmResize is a php class that works as a wrapper for the netpbm binaries which are easily obtainable thanks to the Gallery project (http://tinyurl.com/25daoc). It is *only* focused on resizing images (by Width, Height, Percentage or Bounding Box) and create square thumbnails.


Author(s):

Methods



Class Details

[line 17]
NetpbmResize is a php class that works as a wrapper for the netpbm binaries which are easily obtainable thanks to the Gallery project (http://tinyurl.com/25daoc). It is *only* focused on resizing images (by Width, Height, Percentage or Bounding Box) and create square thumbnails.

It supports JPG, GIF and PNG.

Its intended audience are php developers who are using images in their applications and need a resizing solution. Most common use would be an application which needs gallery functionality.




Tags:

author:  Favio Manriquez <favio@favrik.com>
see:  ImageInfo
access:  public


[ Top ]


Class Methods


constructor NetpbmResize [line 84]

NetpbmResize NetpbmResize( string $NetpbmPath, string $Path)

Constructor.



Tags:

access:  public


Parameters:

string   $NetpbmPath   path to netpbm binaries WITHOUT trailing slash
string   $Path   path to working dir which may include the output filename WITHOUT trailing slash

[ Top ]

method getDestination [line 494]

string getDestination( void 0)

Calculates the resized image filaname since it can come from $OutputImage or just be the original filename with a suffix appended.



Tags:

return:  final full path of the resized image
access:  public


Parameters:

void   0  

[ Top ]

method getHeight [line 154]

void getHeight( )



[ Top ]

method getNiceName [line 235]

string getNiceName( void 0)

Returns the nice name (without spaces, special chars, etc.) of the last image processed.



Tags:

return:  image name
access:  public


Parameters:

void   0  

[ Top ]

method getOutputImage [line 210]

string getOutputImage( void 0)

Gets the filename of the resized image.



Tags:

return:  output image filename
access:  public


Parameters:

void   0  

[ Top ]

method getWidth [line 150]

void getWidth( )



[ Top ]

method getWorkingDir [line 188]

string getWorkingDir( void 0)

Gets the working directory.



Tags:

return:  working directory
access:  public


Parameters:

void   0  

[ Top ]

method resize [line 331]

void resize( mixed $pixels, [string $image = ''])

Generic resize method, it defaults to resize by Bounding Box. The first parameter can also be an array containing different dimensions and suffixes so you can have different resized versions of the original image.



Tags:

see:  NetpbmResize::resizeByBoundingBox()
access:  public


Parameters:

mixed   $pixels   pixels to be resized by
string   $image   input image filename

[ Top ]

method resizeByBoundingBox [line 392]

void resizeByBoundingBox( integer $cols, integer $rows, [string $image = ''])

This does a bounding box resize. It will try to fit the image into a box with the columns and rows specified.



Tags:

access:  public


Parameters:

integer   $cols   number of columns of the bounding box
integer   $rows   number of rows of the bounding box
string   $image   input image filename without path info

[ Top ]

method resizeByDimensions [line 410]

void resizeByDimensions( integer $width, integer $height, [string $suffix = ''], [string $image = ''])

This does a specific resize. It resizes the image to the specified dimensions without altering the aspect ratio, but of course the algorithm used centers the new frame and some portions of the image are lost. Also, the original image should be larger than the target image.



Tags:

access:  public


Parameters:

integer   $width   target width of image
integer   $height   target height of image
string   $suffix   image suffix to be used
string   $image   input image filename without path info

[ Top ]

method resizeByHeight [line 364]

void resizeByHeight( integer $pixels, [string $image = ''])

Resizes an image taking height as the base dimension.



Tags:

access:  public


Parameters:

integer   $pixels   pixels to be resized by
string   $image   input image filename

[ Top ]

method resizeByPercentage [line 377]

void resizeByPercentage( mixed $percentage, [string $image = ''])

Resizes an image by a percentage.



Tags:

access:  public


Parameters:

mixed   $percentage   float or int taken as a percentage
string   $image   input image filename

[ Top ]

method resizeByWidth [line 351]

void resizeByWidth( integer $pixels, [string $image = ''])

Resizes an image taking width as the base dimension.



Tags:

access:  public


Parameters:

integer   $pixels   pixels to be resized by
string   $image   input image filename

[ Top ]

method setImage [line 221]

void setImage( string $image)

Checks if image is empty, if not sets the image info object



Tags:

access:  public


Parameters:

string   $image   image name without path

[ Top ]

method setImageInfo [line 143]

void setImageInfo( string $Image)

Initializes the ImageInfo object useful for retrieving Image info.



Tags:

see:  ImageInfo
access:  public


Parameters:

string   $Image   full path to an image file

[ Top ]

method setOutputImage [line 199]

void setOutputImage( string $filename)

Sets the filename of the resized image.



Tags:

access:  public


Parameters:

string   $filename   output image filename

[ Top ]

method setSuffix [line 166]

void setSuffix( string $suffix)

Sets the default suffix of the the resized image.



Tags:

see:  $DefaultSuffix
access:  public


Parameters:

string   $suffix   suffix to be used for the resized image

[ Top ]

method setWorkingDir [line 177]

void setWorkingDir( string $dir)

Sets the working directory.



Tags:

access:  public


Parameters:

string   $dir   working directory

[ Top ]

method squareThumbnail [line 260]

void squareThumbnail( int $size, [string $suffix_op = ''])

Uses pnmcut to produce square thumbnails (pnmcut left top width height).

First slices the square centered region of the input image and then resizes that to the dimension specified.




Tags:

access:  public


Parameters:

int   $size   dimension
string   $suffix_op   optional suffix for resulting image

[ Top ]


Documentation generated on Thu, 02 Aug 2007 21:20:13 -0700 by phpDocumentor 1.3.2

SourceForge.net Logo