Zeile 11 | Zeile 11 |
---|
/** * Generates a thumbnail based on specified dimensions (supports png, jpg, and gif) *
|
/** * Generates a thumbnail based on specified dimensions (supports png, jpg, and gif) *
|
* @param string the full path to the original image * @param string the directory path to where to save the new image * @param string the filename to save the new image as * @param integer maximum hight dimension * @param integer maximum width dimension
| * @param string $file the full path to the original image * @param string $path the directory path to where to save the new image * @param string $filename the filename to save the new image as * @param integer $maxheight maximum hight dimension * @param integer $maxwidth maximum width dimension
|
* @return array thumbnail on success, error code 4 on failure */ function generate_thumbnail($file, $path, $filename, $maxheight, $maxwidth)
| * @return array thumbnail on success, error code 4 on failure */ function generate_thumbnail($file, $path, $filename, $maxheight, $maxwidth)
|
Zeile 33 | Zeile 33 |
---|
$imgheight = $imgdesc[1]; $imgtype = $imgdesc[2]; $imgattr = $imgdesc[3];
|
$imgheight = $imgdesc[1]; $imgtype = $imgdesc[2]; $imgattr = $imgdesc[3];
|
$imgbits = $imgdesc['bits']; $imgchan = $imgdesc['channels'];
| $imgbits = isset($imgdesc['bits']) ? $imgdesc['bits'] : null; $imgchan = isset($imgdesc['channels']) ? $imgdesc['channels'] : null;
|
if($imgwidth == 0 || $imgheight == 0) {
| if($imgwidth == 0 || $imgheight == 0) {
|
Zeile 157 | Zeile 157 |
---|
/** * Attempts to allocate enough memory to generate the thumbnail *
|
/** * Attempts to allocate enough memory to generate the thumbnail *
|
* @param integer hight dimension * @param integer width dimension * @param string one of the IMAGETYPE_XXX constants indicating the type of the image * @param string the bits area the number of bits for each color * @param string the channels - 3 for RGB pictures and 4 for CMYK pictures
| * @param integer $width width dimension * @param integer $height height dimension * @param string $type one of the IMAGETYPE_XXX constants indicating the type of the image * @param string $bitdepth the bits area the number of bits for each color * @param string $channels the channels - 3 for RGB pictures and 4 for CMYK pictures * @return bool
|
*/ function check_thumbnail_memory($width, $height, $type, $bitdepth, $channels) {
| */ function check_thumbnail_memory($width, $height, $type, $bitdepth, $channels) {
|
Zeile 177 | Zeile 178 |
---|
}
$limit = preg_match("#^([0-9]+)\s?([kmg])b?$#i", trim(my_strtolower($memory_limit)), $matches);
|
}
$limit = preg_match("#^([0-9]+)\s?([kmg])b?$#i", trim(my_strtolower($memory_limit)), $matches);
|
$memory_limit = 0;
| $memory_limit = (int)$memory_limit;
|
if($matches[1] && $matches[2]) { switch($matches[2])
| if($matches[1] && $matches[2]) { switch($matches[2])
|
Zeile 217 | Zeile 218 |
---|
@ini_set("memory_limit", $memory_limit); }
|
@ini_set("memory_limit", $memory_limit); }
|
| return true;
|
}
/** * Figures out the correct dimensions to use *
|
}
/** * Figures out the correct dimensions to use *
|
* @param integer current hight dimension * @param integer current width dimension * @param integer max hight dimension * @param integer max width dimension
| * @param integer $width current width dimension * @param integer $height current height dimension * @param integer $maxwidth max width dimension * @param integer $maxheight max height dimension
|
* @return array correct height & width */ function scale_image($width, $height, $maxwidth, $maxheight)
| * @return array correct height & width */ function scale_image($width, $height, $maxwidth, $maxheight)
|