Not cropping images in the starter kit template

Hi!

I’m trying to modify the starter kit album page so it doesn’t crop photos.

This is the code for the gallery section:

  <ul class="album-gallery"<?= attr(['data-even' => $gallery->isEven(), 'data-count' => $gallery->count()], ' ') ?>>
      <?php foreach ($gallery as $image): ?>
      <li>
        <figure>
          <a href="<?= $image->link()->or($image->url()) ?>">
            <?= $image->crop(6000, 6000) ?>
          </a>
        </figure>
      </li>
      <?php endforeach ?>
    </ul>
  </article>
</main>

No matter how much I bump up the crop value, it only follows the aspect ratio. (Ex: When i set it to 6000x6000, instead of letting the photos be up to that size, it crops them to square). Ideally, it wouldn’t crop the photos at all. Removing the line with the $image crop function seems to just remove the photos entirely.

Any help would be appreciated.

Thanks,

Max

If you don’t want to resize or crop the image, you can leave it a is:

 <?= $image ?>

Or you can resize instead of crop, preserving the image ratio:

 <?= $image->resize(400) ?>
1 Like

Sweet! Thanks :slight_smile: