Hi guys I am in the process of building an image uploader application for a customer (for his gallery).
So far, I have built a class that will allow my client to upload an image to a folder on the server and at the same time insert the name of the image to a table on phpmyadmin.
Just to keep things simple I have set things up so my client can only upload jpg files.
Now the problem I am having is when I try to display the images on the gallery page, only some of the images will show up and the others show up as broken links.
Here is the code that seems to be causing me problems (the actual gallery page itself):
<?php
require_once( "gallery_upload_class.php" );
?>
<html>
<head>
</head>
<body>
<h1 style="text-align: center;">Misc Gallery</h1>
<?php
$start = isset($_GET["start"]) ? (int)$_GET["start"] : 0;
$num = 50;
if( !$images = galleryupload::getimages( $start, $num, "misc" ) ){
echo "cannot retieve images!";
}
foreach( $images as $img ){
?>
<img src="..\images\misc\<?php echo $img->data["img_name"] . ".JPG"; ?>">
<?php
}
?>
</body>
</html>
The source of the problem seems to specifically be with this snippet of code:
foreach( $images as $img ){
?>
<img src="..\images\misc\<?php echo $img->data["img_name"] . ".jpg"; ?>">
<?php
}
?>
If I don't add ".jpg" at the end of the line:
<img src="..\images\misc\<?php echo $img->data["img_name"] . ".jpg"; ?>">
.... then absolutely no images will display on the page.
And if I do add ".jpg" at the end of the line only some of the images will display on the page.
Are there any functions or is there anything I could do to fix this problem?
Here are the names of the images (if it helps):
20170710195537JensPulver_display_image_display_image (DOES NOT DISPLAY!!)
20170710202236Frankie-Sandford (DOES DISPLAY!!) ----- THE ONLY IMAGE THAT DISPLAYS (THE REST OF THE LINKS ARE BROKEN)
2017071019544116axgfk (DOES NOT DISPLAY!!)
20170710195452389px-Maeda_ca._1910 (DOES NOT DISPLAY!!)
20170710195502385516_2637472250479_1065663236_32820655_825245900_n (DOES NOT DISPLAY!!)
20170710195516225382_1886713420086_1608941075_1851437_4323404_n (DOES NOT DISPLAY!!)
Paul.