Final image URL is broken
Web server: NGINX PHP Version: 5.5.9-1ubuntu4.14
I am getting this error Final image URL is broken. The page looks like this
There should be 100 images displayed but it dies at the third.
It is returning this url
There should be a / between the mediapage.zips.me and core, however it is a local image so I don't see why it should even need the host name.
How I am doing this is,
On the top of each page I am calling another page which contains the setup of the class
<?php
//Calls the php-image things
include 'test.php';
?>
Inside test.php
<?php
require_once 'core/classes/ImageCache.php';
$imagecache = new ImageCache();
?>
Image page
<?php
//Directory NON-CACHED images are stored in
$dir = "i/";
//Array of files in the Directory
$files1 = scandir($dir);
//Used to limit results (100's of images)
$count = 0;
foreach ($files1 as $key) {
//If the file name is longer than 3 chars and the count is less
//than the amount of images I want displayed.
if (strlen($key) > 3 && $count <= 100){
$count++;
//dir2 is the directory/nameofFile.extension
//Eg: i/testImage.png
$dir2 = $dir.''.$key;
$info = new SplFileInfo($key);
//Image Cache variable
$cached_src = $imagecache->cache($dir2);
?>
<tr>
<td>
<!-- Link for light box for full resolution image -->
<a href="<?php echo $dir2;?>" data-popup="lightbox">
<!-- src of cached image is outputted and the alt is the name of the uncached image. -->
<img src="<?php echo $cached_src;?>" alt="<?php echo $key;?>" class="img-rounded img-preview">
</a>
</td>
<!-- More table stuff... -->
</tr>
<?php
} //End If
} //End for
?>
Try: In ImageCache.php file: search words:"docroot_to_url($src = null)", then replace "$image_url = $url . substr($image_path, 1);" to "$image_url = '/'. substr($image_path, 1);" good luck
after struggling a little bit about this issue I think I've finally resolved it. Please replace 1 with 0 as you cans see below in docroot_to_url function. Let me know if it works for you.