When the gallery is loaded not all images are showing up. It is random. Meaning that sometimes the pages shows image 5 and the next it does not. It only happens when a lot of images need to get loaded.
I work with codeigniter and the images are stored outside of the htdocs folder. So therefore I work with a img controller to load in the images.
I only recently noticed this issue because it is the first time I need to load in 500+ images. So I presume it has something to do with the number of images the site needs to process.
IMG controller
public function jpg($foldername, $file)
{
if(($foldername != null) && ($file != null))
{
$filename = basename($file);
$file_extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
switch($file_extension)
{
case "gif": $contentType="image/gif"; break;
case "png": $contentType="image/png"; break;
case "jpeg": $contentType="image/jpeg"; break;
case "jpg": $contentType="image/jpeg"; break;
default:
}
$path = DOCROOT . GALLERYS . $foldername . '/' . $file;
header('Content-type: ' . $contentType);
readfile($path);
}
}
Example of the code beeing used. It is used in a foreach but as it is kinda complex I will just show this.
$imageLocation = 'img/jpg/' . $folderName . '/' . $img['image_name'];
$id = $selected_gallery . $counter;
<img src="<?php echo base_url($imageLocation); ?>" alt="<?php echo $selected_gallery . ' ' . $counter; ?>">
I am looking for a solution so I can be sure it is all loaded in correctly.