Forum

Thread tagged as: Question, Problem

Can't seem to access crops of image within template

Hi there,

I have a template that generates some different size variants of my thumbnail image like so:

<perch:content id="project_thumb" type="image" bucket="Projects" width="1200" height="1000" crop="true" label="Thumbnail" suppress="true" required="true" order="6" />
<perch:content id="project_thumb" type="image" bucket="Projects" width="780" height="650" crop="true" suppress="true" />

The latter image field gets used on a listing page and work's as I'd expect. On the main page for each project, I want to pull out a specific size, i.e. the larger image but when I take a look at the query I'm using, I can only see the original image under project_thumb. From memory, I should be able to see an array of the generated sizes, shouldn't i? I can see in my resources folder that Perch has indeed generated the variants.

My query:

// filter the work query
    $query = perch_content_custom('Work', [
        'filter' => 'project_slug',
        'match' => 'eq',
        'value' => perch_get('s'),
        'count' => 1,
        'skip-template' => true,
        'return-html' => true,
    ]);

    print "<pre>";
    print_r($query);
    print "</pre>";

When looking for the thumbnail, I can only see:

[project_thumb] => /perch/resources/Projects/sj-thumb.jpg

Mathew Doidge

Mathew Doidge 2 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

How are you using the tag in your template?