Greetings! 🙂
Well, my hosting has this kind of GD
gd
GD Support enabled
GD Version bundled (2.0.28 compatible)
GIF Read Support enabled
GIF Create Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
And my localhost server has this kind of GD
gd
GD Support enabled
GD Version bundled (2.0.15 compatible)
FreeType Support enabled
FreeType Linkage with freetype
GIF Read Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
I'm the one with the lower version, so I bet the old commands would work the same way in the one of my hoster, but it isn't that way.
In my host, I get this error:
Warning: imagecopyresized(): supplied argument is not a valid Image resource in /home/3852570779/dbfree/web/site/thumb.php on line 39
Fatal error: Call to undefined function: imagejpeg() in /home/3852570779/dbfree/web/site/thumb.php on line 40
Thumb.php is this:
<?
$pics=$_GET['file'];
$me=resizepics($pics,'100','100');
echo $me;
function resizepics($pics, $newwidth, $newheight){
$newwidth=120;
$newheight=120;
if(preg_match("/.jpg/i", "$pics")){
header('Content-type: image/jpeg');
}
if (preg_match("/.gif/i", "$pics")){
header('Content-type: image/gif');
}
list($width, $height) = getimagesize($pics);
if($width > $height && $newheight < $height){
$newheight = $height / ($width / $newwidth);
} else if ($width < $height && $newwidth < $width) {
$newwidth = $width / ($height / $newheight);
} else {
$newwidth = $width;
$newheight = $height;
}
if(preg_match("/.jpg/i", "$pics")){
$source = imagecreatefromjpeg($pics);
}
if(preg_match("/.jpeg/i", "$pics")){
$source = imagecreatefromjpeg($pics);
}
if(preg_match("/.jpeg/i", "$pics")){
$source = Imagecreatefromjpeg($pics);
}
if(preg_match("/.png/i", "$pics")){
$source = imagecreatefrompng($pics);
}
if(preg_match("/.gif/i", "$pics")){
$source = imagecreatefromgif($pics);
}
$thumb = imagecreatetruecolor(120,120);
imagecopyresized($thumb, $source, 0, 0, 0, 0, 120, 120, $width, $height);
return imagejpeg($thumb);
if(preg_match("/.jpg/i", "$pics")){
return imagejpeg($thumb);
}
if(preg_match("/.jpeg/i", "$pics")){
return imagejpeg($thumb);
}
if(preg_match("/.jpeg/i", "$pics")){
return imagejpeg($thumb);
}
if(preg_match("/.png/i", "$pics")){
return imagepng($thumb);
}
if(preg_match("/.gif/i", "$pics")){
return imagegif($thumb);
}
}
?>
Could someone help me here and tell me what's wrong here? it works correctly on my comp but not in the hoster, what it's wrong with it? If anyone could, well, thanks in advance 🙂