Hello,
try to use the thumb() function with a simple slider,
but how get the link to the created thumb file?
this line: thumb($file, array(‘width’ => 300))
produced only the link to the original image
<?php
// SLIDER
// Transform the comma-separated list of filenames into a file collection
$filenames = $article->attachments()->split(',');
if(count($filenames) > 2)
{
$filenames = array_pad($filenames, 2, '');
echo '<div class="slider">';
echo ' <div class="slider_nav">';
echo ' <a class="back" href=""></a>';
echo ' <a class="next" href=""></a>' ;
echo '</div>';
echo '<ul>';
$files = call_user_func_array(array($article->files(), 'find'), $filenames);
// Use the file collection
foreach($files as $file)
{
//echo $file->url();
echo "<li>".thumb($file, array('width' => 300))."</li>";
}
echo '</ul>';
echo '</div>';
}
//IMAGE WITHOUT SLIDER
else
{
$filenames = array_pad($filenames, 2, '');
$files = call_user_func_array(array($article->files(), 'find'), $filenames);
// Use the file collection
foreach($files as $file)
{
//echo $file->url();
echo "<li>".thumb($file, array('width' => 300))."</li>";
}
echo '<figcaption>'.$article->caption()->kirbytext().'</figcaption>';
}
?>
greetings perry