Hi there,
I’m using Fotorama for display a gallery of images and I need to get the images in the folder …/full of the project dir (the one that contains the full images).
<?php foreach($page->images()->sortBy('sort', 'asc') as $image): ?>
<div class="fotorama">
<a href="<?php echo $image->url() ?>"
data-caption="<?php echo html($image->caption()) ?> <?php echo html($image->photographer()) ?>"
data-full="URL OF THE FOLDER THAT CONTAINS FULL IMAGES"></a>
</div>
<?php endforeach ?>
Here below the folder structure:
~/Sites/landscapestories/content/0-home/000_test
.
├── Schink_01.jpg
├── Schink_01.jpg.txt
├── ...
├── Schink_20.jpg
├── full
│ ├── Schink_01.jpg
│ ├──...
│ └── Schink_20.jpg
└── project.en.txt
How can I get the url of the corresponding image in the folder full?
Thanks,
Fabio
The url of the folder should be
<?php echo $site->url() . "/" . $page->uri() . "/full" ?>
The full url of the file can be returned by adding the filename to the path
$page->images()->first()->filename()
so the full php code should be
<?php echo $site->url() . "/" . $page->uri() . "/full/" . $page->images()->first()->filename() ?>
Thanks, but doesn’t works
Here the output:
<div class="fotorama">
<a href="http://localhost/~fabio/landscapestories/content/0-home/000_test_resize/Schink_01.jpg"
data-caption="9/17/2006, 8:45 am – 9:45 am, N 78°13.370' E 015°40.024' Hans-Christian Schink"
data-full="http://localhost/~fabio/landscapestories/home/000_test_resize/full/Schink_01.jpg"></a>
</div>
<div class="fotorama">
<a href="http://localhost/~fabio/landscapestories/content/0-home/000_test_resize/Schink_02.jpg"
data-caption=" "
data-full="http://localhost/~fabio/landscapestories/home/000_test_resize/full/Schink_01.jpg"></a>
</div>
<div class="fotorama">
<a href="http://localhost/~fabio/landscapestories/content/0-home/000_test_resize/Schink_03.jpg"
data-caption=" "
data-full="http://localhost/~fabio/landscapestories/home/000_test_resize/full/Schink_01.jpg"></a>
</div>
As you can see the path is not correct and the image is always 01.jpg.
Try this:
<?php echo $site->url() . '/content/' . $page->diruri(). "/full/" . $image->filename(); ?>
I got this error:
Whoops\Exception\ErrorException thrown with message "parse error"
Stacktrace:
#0 Whoops\Exception\ErrorException in /Users/fabio/Sites/landscapestories/site/templates/project.php:34
Ok, got it.
There is double echo 
This is the correct one:
<?php echo $site->url() . '/content/' . $page->diruri(). "/full/" . $image->filename(); ?>
Oops, sorry don’t know how that got there 