Forum

Thread tagged as: Question, Problem, Configuration

Assets/Buckets Question

I am working on a site that started out in Development on 2.4.9. I have since updated it to 2.5 and the Assets app is brilliant. I have now decided for practicality to start putting assets into buckets like "press-releases" (this one is for content uploaded through blog) "logos" (pages), "feature-images" (pages) etc.

Is there any way for Perch to "re-file" my assets into the correct buckets (and associated folders), or is this something that will happen organically as assets are replaced? I have noticed that in the case of my "press-releases" bucket, only press releases are shown when I go to choose one now, but they don't seem to have moved physically into the folder as defined in my buckets.php file.

Now Media

Now Media 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Perch won't move the assets, but they should be uploaded to the correct bucket folder. Is that not happening?

Unfortunately not, and there are no buckets listed in the dropdown in the assets module.

This is my buckets.php file by the way

<?php 
    return array(
        'news-press-releases' => array(
            'web_path'  => '/cms/resources/press-releases/',
            'file_path' => $_SERVER['DOCUMENT_ROOT'].'/cms/resources/press-releases/'
        ),
        'logos' => array(
            'web_path'  => '/cms/resources/logos',
            'file_path' => $_SERVER['DOCUMENT_ROOT'].'/cms/resources/logos/'
        )
    );
?>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have any files ended up in your buckets?

No. They just end up in the root of the resources folder

Replying just to say I have the same problem - the bucket will be created but the file itself gets uploaded into the default directory (the resources folder).

Yeah thats exactly it. Perch has created the folder, but isn't using it. Happening in templates in both Blog and Pages. My first thought was it was just a blog oddity.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, looks like something we need to look into. Leave it with me.

Thanks Drew

Am experiencing same issue - images were uploading to buckets specified in perch tags (e.g. bucket="posts") prior to upgrading to 2.5 but are now just going to the default resource root directory.

Any luck with solution as yet?

Another quick note. This is also happening on a site I have setup yesterday with a clean 2.5 install. Also, when you upload an asset from a region, sometimes it doesn't show in the asset panel. You have to leave the region and go back in for it to show.

Drew McLellan

Drew McLellan 2638 points
Perch Support

This should be fixed in yesterday's Perch 2.5.1 release. Could you try?

Upgraded (on the clean site I created yesterday) The folders are being created, but the images are still going into the general area.

My buckets.php

<?php 
    return array(
        'hero_images-mobile' => array(
            'web_path'  => '/cms/resources/hero-images-mobile/',
            'file_path' => $_SERVER['DOCUMENT_ROOT'].'/cms/resources/hero-images-mobile/'
        ),
        'hero_images-tablet' => array(
            'web_path'  => '/cms/resources/hero-images-tablet/',
            'file_path' => $_SERVER['DOCUMENT_ROOT'].'/cms/resources/hero-images-tablet/'
        ),
        'hero_images-desktop' => array(
            'web_path'  => '/cms/resources/hero-images-desktop/',
            'file_path' => $_SERVER['DOCUMENT_ROOT'].'/cms/resources/hero-images-desktop/'
        ),
    );
?>

And my markup

<div class="homehero__img">
    <span data-picture data-alt="">
        <span data-src="<perch:content id="small-image" type="image" label="Phone Image" help="Image to be shown on Mobile Devices - 602 x 376" order="2" bucket="hero_images-mobile" />"></span>
        <span data-src="<perch:content id="medium-image" type="image" label="Tablet Image" help="Image to be shown on Tablet Devices - 1460 x 718" order="3" bucket="hero_images-tablet" />"     data-media="(min-width: 650px)"></span>
        <span data-src="<perch:content id="large-image" type="image" label="Desktop Image" help="Image to be shown on Desktop Devices - 2205 x 895"  order="4" bucket="hero_images-desktop" />"     data-media="(min-width: 900px)"></span>
        <noscript><img src="<perch:content id="medium-image" type="image" label="Medium Image" help="Image to be shown on Tablet Devices - 1460 x 718" order="3" bucket="hero_images-tablet" />" alt="<perch:content id="title" type="text" label="Title" required="true" /><perch:if exists="body"> <perch:content id="body" type="text" label="Line 2 (optional)"  order="6"/></perch:if>"></noscript>
    </span>
</div>

And the result

<div class="homehero__img">
    <span data-picture data-alt="Alt">
        <span data-src="/cms/resources/mobile.jpg"></span>
        <span data-src="/cms/resources/tablet.jpg"     data-media="(min-width: 650px)"></span>
        <span data-src="/cms/resources/desktop.jpg"     data-media="(min-width: 900px)"></span>
        <noscript><img src="/cms/resources/tablet.jpg" alt="Alt"></noscript>
    </span>
</div>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, that's not what's happening here, so I'll see what I can do to track it down.

Similar situation here. Although I don't see any directories being created: Can I check to see if the buckets.php file is being run?

I haven't tried using buckets before but now, with Assets, it would be a really good idea. I've upgraded to 2.5.1. John

I don't know if this is related, but I have also set a width attribute on a perch image tag, to have perch scale down any images uploaded over that width (800px in this case). It doesn't seem to be resizing the image. They are still coming out full size (or in this case, throwing me a white page when I save the region). The image in the resource folder is still 4000px wide and 2mb in size.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't think that would be related.

This is working nicely now: buckets are there and assets are going into the bucket specified in the content templates. I checked through everything carefully and then realised that only new images (the assets I'm working with) that are uploaded whilst editing a region end up in the bucket specified [in the content template]. If you select an image from the existing assets they won't move from the bucket they are in. And I know this has been mentioned elsewhere but I hadn't managed to join up the dots!

Incidentally, I can't get the Asset sidebar to scroll in Safari 7.0.4 (Mac OS 10.9.3) nor Firefox 30.0: it's fine in Chrome.

The buckets look like they are working fine for me now. Not sure why they weren't yesterday

Sorry to be a pain. This may all be user error. The images are now ending up in the right folders on the server, and the bucket name is appearing in the dropdown. But they are not actually showing in the assets pane at all. When you filter by bucket name it says "No matching assets found"