Images not displaying
-
Hi all,
I’ve added the following code to my footer.php template file to display a series of logos held in a ‘Sponsors’ sub-folder contained within the ‘Gallery’ directory I’ve created using the NextGEN plugin:
<?php $physicalPath = ABSPATH . "wp-content/gallery/sponsors/"; # Location of Sponsors Logos in Gallery Folder $thumbs = "thumbs/"; # Thumbnails Sub-folder within Sponsors Folder (to be ignored) if ($handle = opendir($physicalPath)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != rtrim($thumbs,"/")) { $files[] = $file; } } closedir($handle); } foreach($files as $file) { $imageInfo = getimagesize($physicalPath.'/'.$file); $physHeight = $imageInfo[1]; $physWidth = $imageInfo[0]; echo '<img src="' . $physicalPath . $file . '" title="'.substr($file,0,-4).'" alt="'.substr($file,0,-4).'" height="'.$physHeight.'" width="'.$physWidth.'" />'; } ?>
Here’s a link to the development site. Scroll to the bottom of the page and within the Sponsors panel you’ll see the problem; the images aren’t displaying – it’s as if they can’t be found, yet I know for certain they are in the relevant folder on the server because I’ve checked.
The width and height elements within the <img> tag are being collected correctly for each image, so it follows that the image must exist for that to happen – so why can’t it actually show it? It’s got me beat!Any ideas where I’m going wrong? I’ve studied and tweaked the code but to no avail. It’s probably pretty straightforward – I’m just tired!
Thanks in advance for any help.
Tony.
- The topic ‘Images not displaying’ is closed to new replies.