Removed Images still appear in the Slideshow

Hi,

when I remove all images but one, then all removed images still appear in my slideshow. Any idea why?
I want images that don’t exist in the folder, to be not shown in the gallery, but they still appear because thumbs.php doesn’t sync the cache if file was removed.

Here’s the responsible code snippet:

<?
$images = $page->images();
$fit = 'fill'; $width = '600'; $height = '300'; $thumbwidth = '72'; $thumbheight =  '72';

if ($page->hasImages() && isset($images)): ?>
    <div class="thumbs">
        <div class="fotorama fotorama-box-shadow" data-auto="true" data-auto="false">

            <?
            foreach($images as $image)
            {
                $caption = ( $image->caption() != '' )? kirbytext($image->caption()) : '';
                $caption_data = ($caption != '') ? ' data-caption="'.$caption.'"' : '';

                $img_url =
                    thumb($image, array(
                        'width' => $width,
                        'height' => $height,
                        'crop' => true,
                        'class' => "$fit",
                        'alt' => strip_tags($caption)
                    ), false);

                $full_url = thumb($image,
                            array(
                                'width' => 1920,
                                'height' => 1080,
                            ) , false);

                $landscape =
                    sprintf(
                        '<a href="%s" data-full="%s"%s></a>',
                        $img_url, $full_url, $caption_data
                    );
                echo $landscape.chr(10);
            }
            ?>

        </div>
    </div>

<? endif ?>

So if checking via $page->hasImages() && isset($images)) is wrong, how do I only show thumbs for those images that still exist in this directory??

$page->images() will definitely not contain deleted images anymore, even if there are still thumbs.
Have you enabled the Kirby cache? If so, try clearing your site/cache directory.

You should also remove the quotes around $fit in this code snippet:

$img_url =
                    thumb($image, array(
                        'width' => $width,
                        'height' => $height,
                        'crop' => true,
                        'class' => "$fit",
                        'alt' => strip_tags($caption)
                    ), false);
```

No the cache is disabled. Oh good catch @texnixe, thank you!

@lukasbestle $page->images() will definitely not contain deleted images anymore

hmm Anymore… What do you mean? Was that an issue at some point and was it an easy fix?

With “anymore” I mean that images won’t be included in the images collection directly after they are deleted. There hasn’t been an issue with it so far.

It’s really strange that it doesn’t work without the cache. Maybe you have a reverse proxy like Varnish in between? Or maybe it’s the browser cache?