Check at run-time for GD 2.x or GD 1.x so we can start using GD 2.x with the new upgraded appdb server
This commit is contained in:
@@ -196,14 +196,17 @@ class Image {
|
|||||||
function resize_image($new_width, $new_height)
|
function resize_image($new_width, $new_height)
|
||||||
{
|
{
|
||||||
// GD 2.x
|
// GD 2.x
|
||||||
// $new = imagecreatetruecolor($new_width, $new_height);
|
if(function_exists("imagecreatetruecolor"))
|
||||||
// GD 1.x
|
{
|
||||||
$new = imagecreate($new_width, $new_height);
|
$new = imagecreatetruecolor($new_width, $new_height);
|
||||||
|
imagecopyresampled($new,$this->image,0,0,0,0,
|
||||||
// GD 2.x
|
$new_width,$new_height,$this->width,$this->height);
|
||||||
// imagecopyresampled($new,$this->image,0,0,0,0,$new_width,$new_height,$this->width,$this->height);
|
} else // GD 1.x
|
||||||
// GD 1.x
|
{
|
||||||
imagecopyresized($new,$this->image,0,0,0,0,$new_width,$new_height,$this->width,$this->height);
|
$new = imagecreate($new_width, $new_height);
|
||||||
|
imagecopyresized($new,$this->image,0,0,0,0,
|
||||||
|
$new_width,$new_height,$this->width,$this->height);
|
||||||
|
}
|
||||||
|
|
||||||
$this->set_debuglog("imagecopyresized($new,$this->image,0,0,0,0,$new_width,$new_height,$this->width,$this->height);");
|
$this->set_debuglog("imagecopyresized($new,$this->image,0,0,0,0,$new_width,$new_height,$this->width,$this->height);");
|
||||||
imagedestroy($this->image);
|
imagedestroy($this->image);
|
||||||
@@ -229,19 +232,27 @@ class Image {
|
|||||||
/* We multiply the border width by two because there are are borders
|
/* We multiply the border width by two because there are are borders
|
||||||
at both sides */
|
at both sides */
|
||||||
// GD 2.x
|
// GD 2.x
|
||||||
// $new = imagecreatetruecolor($new_width + ($border_width*2), $new_height + ($border_width*2));
|
if(function_exists("imagecreatetruecolor"))
|
||||||
// GD 1.x
|
{
|
||||||
$new = imagecreate($new_width + ($border_width*2), $new_height + ($border_width*2));
|
$new = imagecreatetruecolor($new_width + ($border_width*2), $new_height + ($border_width*2));
|
||||||
|
} else // GD 1.x
|
||||||
|
{
|
||||||
|
$new = imagecreate($new_width + ($border_width*2), $new_height + ($border_width*2));
|
||||||
|
}
|
||||||
|
|
||||||
/* Make the border by filling it completely,
|
/* Make the border by filling it completely,
|
||||||
later on we will overwrite everything except the border */
|
later on we will overwrite everything except the border */
|
||||||
$color = ImageColorAllocate( $new, $r, $g, $b );
|
$color = ImageColorAllocate( $new, $r, $g, $b );
|
||||||
imagefill($new,0,0,$color);
|
imagefill($new,0,0,$color);
|
||||||
|
|
||||||
// GD 2.x
|
// GD 2.x
|
||||||
// imagecopyresampled($new,$this->image,$border_width,$border_width,0,0, $new_width,$new_height,$this->width,$this->height);
|
if(function_exists("imagecopyresampled"))
|
||||||
// GD 1.x
|
{
|
||||||
imagecopyresized($new,$this->image,$border_width,$border_width,0,0,$new_width,$new_height,$this->width,$this->height);
|
imagecopyresampled($new,$this->image,$border_width,$border_width,0,0, $new_width,$new_height,$this->width,$this->height);
|
||||||
|
} else // GD 1.x
|
||||||
|
{
|
||||||
|
imagecopyresized($new,$this->image,$border_width,$border_width,0,0,$new_width,$new_height,$this->width,$this->height);
|
||||||
|
}
|
||||||
|
|
||||||
$this->set_debuglog("imagecopyresized($new,$this->image,$border_width,$border_width,0,0,"
|
$this->set_debuglog("imagecopyresized($new,$this->image,$border_width,$border_width,0,0,"
|
||||||
." $new_width,$new_height,$this->width,$this->height); with a $border_width px border"
|
." $new_width,$new_height,$this->width,$this->height); with a $border_width px border"
|
||||||
|
|||||||
Reference in New Issue
Block a user