Images isn't showing
Posted: Fri Jul 11, 2014 7:03 am
Hi,
I'm quite new to PHP. As a part of my learning process, I'm trying to show a list of images in a page, but unfortunately the images aren't showing !!!
I've saved my variables in a seperate file, in there I've saved the upload path, like below :
After that, I've wrote the code and used that upload path by "require_once". The code is here :
After this I've put the images in the "images" folder, located in the same folder with the "index.php".
It seems everything is okay to me, but unfortunately the images are missing when I'm accessing the page via a browser (please check the attached screenshot)
I'd be really grateful if anyone could help me to solve this issue.
Thanks in advance.
I'm quite new to PHP. As a part of my learning process, I'm trying to show a list of images in a page, but unfortunately the images aren't showing !!!
I've saved my variables in a seperate file, in there I've saved the upload path, like below :
Code: Select all
define('MM_UPLOADPATH', 'images/');Code: Select all
while ($row = mysqli_fetch_array($data)) {
if (is_file(MM_UPLOADPATH . $row['picture']) && filesize(MM_UPLOADPATH . $row['picture']) > 0) {
echo '<tr><td><img src="' . MM_UPLOADPATH . $row['picture'] . '" alt="' . $row['first_name'] . '" /></td>';
}
else {
echo '<tr><td><img src="' . MM_UPLOADPATH . 'nopic.jpg' . '" alt="' . $row['first_name'] . '" /></td>';
}
echo '<td>' . $row['first_name'] . '</td></tr>';
}It seems everything is okay to me, but unfortunately the images are missing when I'm accessing the page via a browser (please check the attached screenshot)
I'd be really grateful if anyone could help me to solve this issue.
Thanks in advance.