Hi, I'm new in php can someone help me with this:
I've got this errors when I try to view an image in my script image.php:
/home/vhost/athernet.co.uk/html/westmeade/images/products/3064827_l.jpg
/home/vhost/athernet.co.uk/html/westmeade/images/products/image_unavailable_l.jpg
Warning: fopen(/home/vhost/athernet.co.uk/html/westmeade/images/products/image_unavailable_m.jpg): failed to open stream: No such file or directory in /home/vhost/athernet.co.uk/html/westmeade/image.php on line 64
Warning: filesize(): Stat failed for /home/vhost/athernet.co.uk/html/westmeade/images/products/image_unavailable_m.jpg (errno=2 - No such file or directory) in /home/vhost/athernet.co.uk/html/westmeade/image.php on line 65
Warning: Cannot modify header information - headers already sent by (output started at /home/vhost/athernet.co.uk/html/westmeade/image.php:57) in /home/vhost/athernet.co.uk/html/westmeade/image.php on line 65
Warning: fpassthru(): supplied argument is not a valid stream resource in /home/vhost/athernet.co.uk/html/westmeade/image.php on line 66
-----image.php--------
include_once("library/config.inc.php");
include_once(COMMON);
include_once(TEMPLATE);
$template=new Template;
$errors=$vars=array();
session_start();
$d = db_c();
// Default to the category page...
$tpl = TPL_CATEGORY;
$page = get_category($_SERVER["REQUEST_URI"]);
// print_r($page);
$i = $page["id"];
$o = $page["other"];
if(($page["type"]=="ip")||($page["type"]=="ic")){
$page_shown=1;
// Display product/category image
$o="_".$o;
$s="SELECT Image FROM Categories WHERE ID = $i";
$img_base=BASE_CAT_IMG_PATH;
if($page["type"]=="ip"){
$s="SELECT Image FROM Products WHERE ID = $i";
$img_base=BASE_PROD_IMG_PATH;
}
$img_f=$img_base.DEFAULT_IMG_F.$o.".jpg";
$q=db_q($s);
if($r=db_r($q))
$img_f=$img_base.strtolower($r["Image"]).$o.".jpg";
echo "<h1>$img_f</h1>";
if(!file_exists($img_f))
$img_f=$img_base.DEFAULT_IMG_F.$o.".jpg";echo $img_f;
if(!file_exists($img_f))
$img_f=$img_base.DEFAULT_IMG_F."_m.jpg";
$img_file_pointer = fopen($img_f, "rb");
header("Content-type: image/jpeg\nContent-Disposition: inline; filename: \"\"; Content-length: ".(string)(filesize($img_f)));
fpassthru($img_file_pointer);
exit;
} if($page["type"]=="lp"){
$page_shown=1;
$s="SELECT Name FROM Products WHERE ID = $i";
$p_name="Unknown Image";
if($a=db_r(db_q($s,$d)))
$p_name=$a["Name"];
else
header("Location: ".createLink('e',2,'error'));
echo "<html>\n";
echo " <head>\n";
echo " <title>".$p_name."</title>\n";
echo " <style>\n";
echo " img.product{\n";
echo " border-top: #a0a0a0 1px solid;\n";
echo " border-left: #a0a0a0 1px solid;\n";
echo " border-right: #a0a0a0 1px solid;\n";
echo " border-bottom: #a0a0a0 1px solid;\n";
echo " }\n";
echo " </style>\n";
echo " </head>\n";
echo " <body leftmargin=\"0\" topmargin=\"5\" marginwidth=\"0\" marginheight=\"0\" onblur=\"this.focus();\">\n";
echo " <center>\n";
echo " <img src=\"".create_image_link('ip',$i,"_l_".$p_name)."\" class=\"product\" alt=\"".$p_name."\" /><br />\n";
echo " <a href=\"javascript:this.close();\" title=\"Close Window\" style=\"font-family: verdana, arial, sans serif; font-size: 0.7em; color: #000000; font-weight: bold; text-decoration: none;\">[ Close Window ]</a>\n";
echo " </center>\n";
echo " </body>\n";
echo "</html>\n";
}
db_d($d);
exit;
?>
😕