I am working on a moderately complex web site and I am getting the subject error in my error.log file.
The jpg file is not displaying, so the error message matches the behavior, but I do not understand why the file is not being found. Earlier in the script it is being found!
In my document root directory I have a file called include.php that is used in initialization. The relevant lines are:
<?php
ini_set('include_path', './../../include');
$cwd = getcwd();
$thumbsdirectory = $cwd . '/thumbs';
The path is for a php file that includes DB access data, and utilities common to all web sites on my host. It is above the document root.
I have a function that prepares the html for displaying an image in the utility file:
function htmlimage($file, $alt) {
$size = getimagesize($file);
$x = "<img src=\\"" . $file . "\\" " . $size['3'] . " alt=\\"" . $alt . "\\" />";
return $x;
}
Of note is the function to access the file and get its dimensions.
The problem area is in this function that is in a file in the document root:
function editphotos( $data ) {
global $thumbsdirectory;
$substance = '';
foreach( $data as $row ) {
$substance .= htmlimage( $thumbsdirectory . '/' . $row['photo_filename'], $row['photo_alt_text'] );
}
return
<<<HEREDOC
<form action= "cp3.php" method="post" name="menu_form">
<h2>Edit Photograph Data</h2>
<input name="choice" type="hidden" value="editphotosform" />
<fieldset>
$substance
</fieldset>
<fieldset>
<input type="submit" name="submitmain" value="Proceed" />
</fieldset>
</form>
HEREDOC;
The function is still under development. At this point I am just trying to display the thumbnail photo. The function gets the result of the DB fetch in the array $data and formats it into the html form for processing. It returns the form in a string to the caller where it is displayed.
I am using full path names to allow for changing directories in the function calls.
Here is the page source:
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="photography, Toronto, weddings, portfolios" />
<meta name="keywords" content="web page, photography, Toronto, weddings, portfolios" />
<title>Control Panel</title>
<link rel="stylesheet" href="dp.css" />
</head><body><div id="inbody">
<div id="top">
<img src="background/title.png" width="800" height="96" alt="Light Writing" />
</div>
<div id="content">
<form action= "cp3.php" method="post" name="menu_form">
<h2>Edit Photograph Data</h2>
<input name="choice" type="hidden" value="editphotosform" />
<fieldset>
<img src="/big0/www/roissy.ca/public_html/dawsonsphotography.com/thumbs/20040603-Lucy-0023-web.jpg" width="150" height="150" alt="Lucy" /><img src="/big0/www/roissy.ca/public_html/dawsonsphotography.com/thumbs/20040603-Lucy_3376-done.jpg" width="150" height="150" alt="Lucy" />
</fieldset>
<fieldset>
<input type="submit" name="submitmain" value="Proceed" />
</fieldset>
</form>
</div>
</div></body>
</html>
The path in the <img src= …> is correct.
But the images do not display, and I get these errors in the log file:
[Fri Dec 16 22:30:58 2011] [error] [client 192.168.1.77] File does not exist: /big0/www/roissy.ca/public_html/dawsonsphotography.com/big0, referer: http://www.dawsonsphotographytest.com/cp2.php
[Fri Dec 16 22:30:58 2011] [error] [client 192.168.1.77] File does not exist: /big0/www/roissy.ca/public_html/dawsonsphotography.com/big0, referer: http://www.dawsonsphotographytest.com/cp2.php
So this has me puzzled.
The log shows the file as:
/big0/www/roissy.ca/public_html/dawsonsphotography.com/big0
sort of of lopping back to the top of the directory.
Now, when the function preparing the html for the image file looks for the file, it finds it. It fills the dimensions of the height and width of the image. The function is in the file in the include directory, above the document root.
But when the final web page is complete and echoed, the image files are not found, and I get the funny error log entry.
Can anyone help me out with this?
Many thanks