Skip to main content

Timeline for Get an image from a random entry

Current License: CC BY-SA 3.0

8 events
when toggle format what by license comment
Jun 7, 2017 at 0:51 history edited brianjhanson CC BY-SA 3.0
Since craft.entries returns an array, we have to access the first item of that array.
Jun 6, 2017 at 17:35 comment added artmem I'm using 2.6.2981
Jun 6, 2017 at 1:02 comment added brianjhanson Interesting, I'm not totally sure what's happening here. Just to confirm, what version of Craft are you using?
May 31, 2017 at 13:56 comment added artmem When i dump randomStat.image, I get this: string(10) ":notempty:" string(10) ":notempty:" string(10) ":notempty:" string(10) ":notempty:" string(10) ":notempty:" string(10) ":notempty:"
May 29, 2017 at 22:43 comment added brianjhanson Can you dump randomStat.image to see what's being returned there? It seems like it's not returning an asset model for some reason.
May 25, 2017 at 16:34 comment added artmem Seems like that should work, but I get this error: Impossible to invoke a method ("first") on a string variable (":notempty:").
May 25, 2017 at 14:44 history edited brianjhanson CC BY-SA 3.0
deleted 2 characters in body
May 25, 2017 at 14:31 history answered brianjhanson CC BY-SA 3.0