0

I have too many images on a overview page, and it kills the server which creates a error 503.

  • I converted all source images to less than 1MB, but it still crashes the server. (Using Imager X on craft 4).
  • It was working under craft 3 but craft 4 seems to be not as resourceful, idk and yeah my code isn't great.
  • php execution time is 300 seconds
  1. Is there a way to see at which image the server goes down?

  2. Is there any way to write the image macro causing this more efficiently?

    {% macro portfolioListing(handleParam, ratioRaram) %}
    {% set image = handleParam %}
    {% import _self as macro %}
    {% if handleParam | length %}
        {% if handleParam.extension == 'svg' %}
            {{ svg(image) }}
        {% else %}
        {% set transformedImages = craft.imager.transformImage(image, 
                [{ width: 170 }, { width: 980 },{ width: 1065 }],
                { jpegQuality: 75, ratio: ratioRaram, allowUpscale: false },
                { filenamePattern: macro.imageNaming(image) | kebab ~ '-' ~ '_{fullname|shorthash}.{extension}' }) 
            %}
    
            <img
                data-sizes="auto"
                src="{{ craft.imager.placeholder() }}"
                data-srcset="{{ craft.imager.srcset(transformedImages) }}"
                alt="{{ macro.imageNaming(image) }}"
                class="lazyload{{ image.dropShadow ? ' dropShadow' : '' }}"
                data-majorImg="{{transformedImages[3].url}}"
            />
        {% endif %}
    
    {% endif %}
    
    {% endmacro %}
    

Not sure how to go about this right now.

1
  • 1
    Have you considered to use Craft's native transforms? Mar 27 at 17:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.