1

I need to list out the image options from a specific assets folder for users to select from. Previously, I accomplished that like this:

{% set folder_id = 5 %}

{% for image in craft.assets.kind('image').folderId(folder_id).order('filename') %}

    {# do stuff, like print image.filename #}

{% endfor %}

And to get the folder ID pre-2.5, I could inspect the folders menu when viewing assets in CP. Now, that appears to be gone in Craft 2.5+ and struggling to find the ID. I'm assuming there must be a way to view the folderId as Craft has a folderId() filter for craft.assets.

Does anyone know?

Thanks,

1 Answer 1

3

You can always check the craft_assetfolders table in the database, find the folder name you're looking for and grab its id.

And it's probably just a typo in your original code, you're setting the folder ID to a variable named folder_id, but you're passing id into .folderId(id).

1
  • Yeah, typo, sorry! Was just typing out an example and not really focused on it. Just looked through the craft_assetfolders table and found them. Thanks!
    – taylor
    Dec 11, 2015 at 0:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.