When assets don't contain valid images that can be processed by Glide (which can happen by migration or by not setting up proper sanitation rules for asset field uploads), a white screen of death due to a division will occur.

This happened to me in various scenarios

  • A migration of legacy data created assets without actual images
  • Images were uploaded in TIFF format
  • Images were uploaded without extension
  • A file's extension doesn't match it's mime_type

This happens because the picture partial tries to divide height by width to get the original image's ratio. To prevent this, we could just wrap the original height calculation within a simple if statement:

{{ if height && width }}
    {{ original_ratio = height / width }}
{{ /if }}