Skip to content

Images won't resize on the live server #11

@lmartins

Description

@lmartins

Im trying to add a image preview on a custom post type, being the image itself provided by ACF. Locally on my machine it works as expected, although on the live server the thumbnails won't get resized and always show full-size.

The code im using for this is:

Jigsaw::add_column('banners', 'Preview', function( $post_id ){

    $banner_type = get_field('banner_type');

    if ( $banner_type === "Banner Top" ) {
        $image = get_field('banner_top_image');
    } else {
        $image = get_field('banner_action_image');
    }

    $post = new TimberPost($post_id);

    if ( strlen( $image ) ){
        $post->preview = new TimberImage( $image );
    }

    $data = Timber::get_context();
    $data['post'] = $post;

    Timber::render('admin/banners-image-preview.twig', $data);

}, 1);

And the contents of the template are just:

<img src="{{post.preview.src|resize(100, 80)}}" />

Any thoughts of what might be happening?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions