I'm trying to have a script check for thumbnails for wallpapers. If one is found it's displayed, if not the script checks the 800x600 wallpaper and creates one. Unfortunately, I'm getting a 'not a valid resource' error from imagecopyresize. Can anyone help me? The script is below:
<?
include($phpbb_root_path . 'config.php');
$imgsrc="<img src=";
$imgsrclose1=" border=0 alt=";
$imgsrclose2="comments >";
$size =" width=400 height=300";
$query ="SELECT * FROM wallpaper ORDER BY wall_id";
$result = @($query);
$src800 = ImageCreateFromjpeg($img800);
$dst800 = ImageCreate(100,75);
$old800x =800;
$old800y =600;
$img800 = "wallpaper/800x600/".$i["wall_name"].($wi[0]);
while ($i = mysql_fetch_assoc($result)){
$c_query ="SELECT count(*) FROM wallcom WHERE wall_id={$i['wall_id']}";
$comresult = MYSQL_QUERY($c_query);
$wi = mysql_fetch_row($comresult);
echo "<a href=wallpaper.php?PL=wallid&&wall=".$i["wall_id"].">";
//if statement checks for thumnail
if (file_exists($i["wall_loc"].$i["wall_thumb"].$i["wall_name"])){
echo $imgsrc.$i["wall_loc"].$i["wall_thumb"].$i["wall_name"].$imgsrclose1.($wi[0]).$imgsrclose2;
echo "</a>";
} else
//if thumnail not found create one from 800x600 image
{ imagecopyresized($dst800,$src800,0,0,0,0,100,75,$old800x,$old800y);
imagejpeg($dst800,$i["wall_loc"].$i["wall_thumb"].$i["wall_name"]);
}
if ($i["wall_id"] == 5){ echo "<br>";}
if ($i["wall_id"] == 10){ echo "<br>";}
if ($i["wall_id"] == 15){ echo "<br>";}
if ($i["wall_id"] == 20){ echo "<br>";}
if ($i["wall_id"] == 25){ echo "<br>";}
if ($i["wall_id"] == 30){ echo "<br>";}
if ($i["wall_id"] == 35){ echo "<br>";}
if ($i["wall_id"] == 40){ echo "<br>";}
}
?>