Renlok Posted October 16, 2007 Share Posted October 16, 2007 Im pretty much a complete noob with GD. Im trying to make a script that will multiple images from a database over a base image. heres the script. <?php //generates pets image header ("Content-type: image/jpeg"); $roeid = $_GET['id']; $query = mysql_query("SELECT t.image FROM roe r LEFT JOIN roetypes t ON ( r.type = t.id ) WHERE r.id = $roeid") or die(mysql_error()); $roeinfo = mysql_fetch_array($query); $baseimg = $roeinfo['image']; //base image $system=explode('.',$baseimg); if (preg_match('/jpg|jpeg/',$system[1])){ $background = imagecreatefromjpeg("images/$baseimg"); } if (preg_match('/png/',$system[1])){ $background = imagecreatefrompng("images/$baseimg"); } //get clothing $sql = "SELECT c.image FROM roewearing w LEFT JOIN roeclothes c ON ( w.clothe = c.id ) WHERE w.roeid = $roeid ORDER BY w.layer DESC"; $query = mysql_query($sql) or die(mysql_error()); while($array = mysql_fetch_array($query)){ //create the loop $clotheimg = $array['image']; $insert = imagecreatefromjpeg("images/clothes/$clotheimg"); imagecolortransparent($insert,imagecolorat($insert,0,0)); // Get overlay image width and hight for later use $insert_x = imagesx($insert); $insert_y = imagesy($insert); imagecopymerge($background,$insert,0,0,0,0,$insert_x,$insert_y,100); //overlay the clothing to the current image } //end the loop imagejpeg($background,"",100); //save the image //createthumb($background,"images/roeimages/$roeid.png",200,200); imagedestroy($background); //clean up the image ?> Quote Link to comment https://forums.phpfreaks.com/topic/73513-solved-gd-image-wont-load/ Share on other sites More sharing options...
BlueSkyIS Posted October 16, 2007 Share Posted October 16, 2007 try using the string NULL instead of double quotes in imagejpeg: imagejpeg($background,NULL,100); Quote Link to comment https://forums.phpfreaks.com/topic/73513-solved-gd-image-wont-load/#findComment-370845 Share on other sites More sharing options...
Renlok Posted October 16, 2007 Author Share Posted October 16, 2007 tried it but it doesn't seem to make any difference. Quote Link to comment https://forums.phpfreaks.com/topic/73513-solved-gd-image-wont-load/#findComment-371035 Share on other sites More sharing options...
cooldude832 Posted October 16, 2007 Share Posted October 16, 2007 on the page click view source and see what it says. Since the header is an image text errors won't output, but they are there in the source code. Quote Link to comment https://forums.phpfreaks.com/topic/73513-solved-gd-image-wont-load/#findComment-371042 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.