good morning,
i’m using the following code to generate a image gallery. it worked as intended until yesterday when i tried to upload some new images. asdf
<?php if($page->gallery()->isNotEmpty()): ?>
<div class="carousel-container">
<div class="gallery">
<div class="carousel">
<?php $images = $page->gallery()->toStructure();
foreach($images as $imagename): ?>
<div class="carousel-cell">
<?php if ($imagename->startSlideshowImage()->isNotEmpty() ) { ?>
<figure>
<?= $imagename->image()->toFile()->resize(1500, null, 70) ?>
<figcaption >
<?= $imagename->image()->toFile()->caption() ?>
<span class="carousel-status"></span>
</figcaption>
</figure>
<?php } else { ?>
<div class="gallery__video">
<iframe id="videoplayer" src="https://player.vimeo.com/video/<?= $imagename->startSlideshowVideo() ?>?background=1&title=0&byline=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<div class="project__controls">
<div class="project__play"></div>
<div class="project__pause"></div>
</div>
</div>
<?php } ?>
</div>
<?php endforeach ?>
</div>
</div>
</div>
<?php endif ?>
the php error is: Call to a member function resize() on null
on this line:
<?= $imagename->image()->toFile()->resize(1500, null, 70) ?>
when i remove this line the the caption lines causes an similar error.
with <?= $page->image()
i can call the images of the page, so it’s not the upload wich is broken (the images are uploaded correctly as well).
all the old galleries work as intended until i upload a new image. so probably the ->resize()
is somehow broken? but i never touched any ‘system’-file of kirby.