Posts by Jay

    Thanks, that's great.

    For anyone that is having the same problem…

    1. Open `buckets.php`

    2. Add something like this:

    1. <?php
    2. return [
    3. 'nameofexistingbucket' => [
    4. 'type' => 'file',
    5. 'web_path' => PERCH_RESPATH . '/nameofexistingbucket',
    6. 'file_path' => PERCH_RESPATH . '/nameofexistingbucket',
    7. 'label' => 'name_of_new_bucket'
    8. ]
    9. ];
    10. ?>

    Hmmm I suppose it could just be a span instead of a div. No other elements on the page are spans at that particular level in the DOM.

    Feels a bit fragile, but good back up if nothing else materialises :)

    Thanks for the suggestion.

    I have a feeling it's not possible to do it how I want but I'll leave the thread open a little longer just in case I've overlooked something!

    I thought of that at first, but the whole nth-of-type is a bit of a misnomer; it would need to be more like an index of the block type.

    Nth of type would give me something like this:

    - block a (1) (nth-of-type: 1)

    - block b (1) (nth-of-type: 2)

    - block a (2) (nth-of-type: 3)

    - block c (1) (nth-of-type: 4)

    - block b (2) (nth-of-type: 5)

    - block b (3) (nth-of-type: 6)

    - block a (3) (nth-of-type: 7)

    Is it possible to get the index number of the block type? For example, if I had 3 different blocks (a, b, and c), and the blocks were output on a page like this:

    - block a (1)

    - block b (1)

    - block a (2)

    - block c (1)

    - block b (2)

    - block b (3)

    - block a (3)

    ^ Where the number in the brackets represents the amount of times the block has been output on the page.

    The problem I'm trying to solve:

    I have a 'pull quote' block type. The second time it's used on the page I'd like to reverse it so that the text floats on the left instead of the right. I've thought about just adding this as a different block type but it would be cool to do this automatically.

    Hmmm ok, most of the time I _do_ want a compressed version though since I can never rely on clients to do so.

    Good to know what I'm dealing with though—thanks.

    Someone in the Slack group suggested that I set the resize dimensions slightly off e.g. '395' rather than '400' to reduce the chances of the client uploading the correct image size.

    I'll use this tip together with an image compression library like Matt suggested.

    I can only assume this is intended behaviour but I've found that if I upload an image that does NOT need to be resized, Perch seemingly will NOT compress the image when generating a version of it.

    e.g. if I upload a file at 4000px by 1460px, and I have the Perch image tag as `<perch:content id="image" type="image" width="4000" height="1460" crop="true" quality="60" />`, Perch will simply copy and rename the image so I'll have two files that are exactly the same size:

    - some-image-w4000h1460.png (same size as `some-image.png`)

    - some-image.png

    What I would expect to happen is that Perch would compress the image while copying it, as per the quality="60" setting, so that `some-image-w4000h1460.png` would be a smaller size than `some-image.png`

    If clients upload an image at the correct size I'd like Perch to compress the image.

    Is this an oversight by any chance?

    So sorry for the delayed response—I realised I hadn't turned on email notifications for the forum!

    Thanks for the suggestions. I finally figured this out, the solution was something like:

    if($this->content['photo']['w'] > $this->content['photo']['h']) {

    return 'this is landscape';


    Template filters are my favourite 'hidden' feature of Perch! So so useful.

    Is it possible to detect whether an uploaded image is landscape or portrait?

    My aim on the front-end is to change the CSS grid column span of the item if an image is 'landscape'

    I've tried using Template Filters, composite field, and even thought about using the 'output' attribute of an image but I'm not sure it's possible.

    My best guess was to use the 'Accessing content' part of Template Filters but I'm not sure it's possible to _just_ access the width or height attributes of an image field.

    It would be great if Runway search performed a bit better.

    A specific suggestion I have is around numbers — I discovered that Runway does not return any results from a collection where I'm searching for an item that is simply named as a number.

    I've attached a real-life screenshot below where I have flooring samples which are named by an ID number.

    When searching for '715' this does not bring up any results in Runway's admin search.

    I believe this is because there are no letters in the name, for example if I rename '715' to '715 test' and search for 'test', the result shows up.