[TYPO3-english] Load Random Image from Directory into a Subpart

Scotty C superscotty19 at yahoo.com
Fri Jun 21 08:38:20 CEST 2013


Hi everyone,

I really thought this would be a simple task, but after hours of scouring the internet and running into plugins that just don't work, I find myself once again at the mercy of the group's wisdom. All I want to do is pop an image into a subpart, with the catch being that the image must be from a directory (not a content element) and pulled at random (as the directory has more than 1 image).

At the most basic, we have:
subparts.BANNER = IMAGE
subparts.BANNER { file = fileadmin/demo/logo.jpg
}

... but:
- how do I load from a generic directory as opposed to specific image? I've seen file.import but can't find documentation (that I understand) on it.
- as for random, I know it's listNum = rand, but again not sure what context to place it in.

My best resource has been here:
http://typo3.org/extension-manuals/mak_stdwrapextended/0.3.1/view/1/5/#id1481231
... but the code from "Switching Image from Page Media" doesn't work (i.e. it renders my subpart blank):
subparts.BANNER = COA_INT
subparts.BANNER = IMAGE
subparts.BANNER {
  required = 1
  file.import= fileadmin/demo/
  file.import.data = levelmedia: -1,slide
  file.import.listNum = rand
  file.import.override.field = media
}


Thanks yet again!
-Scott.


More information about the TYPO3-english mailing list