I have a bunch of images that aren't related to any entries but are in an asset source. Let's call this 'My Images'.

How do I just grab those assets? I can't find anything in the docs that suggests this is possible—it seems such an obvious use-case though I'm sure I am missing something.

2 Answers 2


What you want is craft.assets

You can access your site’s assets from your templates via craft.assets. It returns an ElementCriteriaModel object.

Use sourceId for the parameter.

To find the sourceId, look at the craft_assetsources table in the database. There doesn't seem to be any way to query for AssetSourceModel.

  • Yes I saw this. It's pretty cryptic though, how do I find the sourceId? Sep 21, 2014 at 12:05
  • 1
    Thanks, this works. Not a very intuitive solution though, I would hope there is a better way than having to look up id's in the database! Sep 22, 2014 at 8:20

You can fetch assets related to a certain source by using the craft.assets.source method and passing in the source handle.

Assuming your handle is 'my_images', the following will do the job:


You avoid having to lookup db IDs that way.

  • 3
    Note: If you want to pull all Assets, be sure to set the limit parameter to null, i.e. {% set assets = craft.assets.source('my_images').limit(null) %}, otherwise your query will be limited to 100 Assets. Dec 5, 2017 at 9:07

Your Answer

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

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