VirtueMart  3.2.14.9808
Public Member Functions | Public Attributes | Private Member Functions | List of all members
Img2Thumb Class Reference

Public Member Functions

 __construct ($filename, $newxsize=60, $newysize=60, $fileout='', $thumbMaxSize=0, $bgred=0, $bggreen=0, $bgblue=0)
 
 check_jpeg ($f, $fix=false)
 

Public Attributes

 $bg_red
 
 $bg_green
 
 $bg_blue
 
 $maxSize
 
 $fileout
 

Private Member Functions

 NewImgCreate ($filename, $newxsize, $newysize, $fileout)
 
 NewImgResize ($orig_img, $newxsize, $newysize, $filename)
 
 NewImgSave ($new_img, $fileout, $type)
 
 NewImgShow ($new_img, $type)
 
 GetImgType ($filename)
 

Detailed Description

class Image2Thumbnail Thumbnail creation with PHP4 and GDLib (recommended, but not mandatory: 2.0.1 !)

Author
Andreas Martens heyn@.nosp@m.plau.nosp@m.tdiet.nosp@m.sch..nosp@m.de
Patrick Teague webdu.nosp@m.de@v.nosp@m.eslac.nosp@m.h.co.nosp@m.m
Soeren Eberhardt <soeren|at|virtuemart.net>
Version
1.0b
Date
modified 11/22/2004
  • added support for GDLib < 2.0.1
    • added support for reading gif images
    • makes jpg thumbnails
    • changed several groups of 'if' statements to single 'switch' statements
  • commented out original code so modification could be identified.

Constructor & Destructor Documentation

Img2Thumb::__construct (   $filename,
  $newxsize = 60,
  $newysize = 60,
  $fileout = '',
  $thumbMaxSize = 0,
  $bgred = 0,
  $bggreen = 0,
  $bgblue = 0 
)

Constructor - requires following vars:

Parameters
string$filenameimage path

These are additional vars:

Parameters
int$newxsizenew maximum image width
int$newysizenew maximum image height
string$fileoutoutput image path
int$thumbMaxSizewhether thumbnail should have background fill to make it exactly $newxsize x $newysize
int$bgred0-255 - red color variable for background filler
int$bggreen0-255 - green color variable for background filler
int$bgblue0-255 - blue color variable for background filler

Member Function Documentation

Img2Thumb::check_jpeg (   $f,
  $fix = false 
)

check for jpeg file header and footer - also try to fix it

Author
willertan1980 at yahoo dot com http://www.php.net/manual/de/function.imagecreatefromjpeg.php
Parameters
$f
bool$fix
Returns
bool
Img2Thumb::GetImgType (   $filename)
private

private function - do not call

1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF

Img2Thumb::NewImgCreate (   $filename,
  $newxsize,
  $newysize,
  $fileout 
)
private

private function - do not call

Img2Thumb::NewImgResize (   $orig_img,
  $newxsize,
  $newysize,
  $filename 
)
private

/** Maybe adding sharpening with $sharpenMatrix = array ( array(-1.2, -1, -1.2), array(-1, 20, -1), array(-1.2, -1, -1.2) );

calculate the sharpen divisor $divisor = array_sum(array_map('array_sum', $sharpenMatrix));

$offset = 0;

apply the matrix imageconvolution($img, $sharpenMatrix, $divisor, $offset);

private function - do not call includes function ImageCreateTrueColor and ImageCopyResampled which are available only under GD 2.0.1 or higher !

Img2Thumb::NewImgSave (   $new_img,
  $fileout,
  $type 
)
private

private function - do not call

Img2Thumb::NewImgShow (   $new_img,
  $type 
)
private

private function - do not call

Member Data Documentation

Img2Thumb::$bg_blue
Img2Thumb::$bg_green
Img2Thumb::$bg_red
Img2Thumb::$fileout
Img2Thumb::$maxSize

The documentation for this class was generated from the following file: