简体   繁体   中英

newb: typo3 access uploaded images in typoscript

I'm trying to do something like in this Tutorial , a very basic gallery.
In the example of the Tut they load images from uploads/media/ like so

page.10.marks.PROJECTTHUMBNAIL = IMG_RESOURCE
page.10.marks.PROJECTTHUMBNAIL {
  stdWrap.wrap = <img src="|" />
  file {
    import = uploads/media/
    import.data = levelmedia: -1,slide  
    import.listNum = 0      
  }
}

but now I want to load pictures that have been uploaded in an image-cObject.

This is an embarrassing question but I've been trying to figure this out for two days and I can't seem to get it right -.- I'm sure there are lots of answers out there... I just don't know the magic words to put into google to FIND them TT

I tried very basic stuff like just doing the same as above but with a different path, I rummaged through the TSRef of IMAGE and IMG_RESOURCE , tried fiddling with CONTENT , and tried to adapt the tt_content.image.20 = USER (?? Oo) description in the typoscript object-browser... but all to no avail, as I know so little what I'm doing -.-

Any nudge in the right direction would be greatly appreciated!

You have to load the content elements using the CONTENT cObject and set how the content shall be rendered. This will load Image content elements on the given page regardless of what column they are in:

page.10.marks.PROJECTTHUMBNAIL = CONTENT
page.10.marks.PROJECTTHUMBNAIL {
  table = tt_content
  select {
    where = CType = 'image' AND image != ''
    orderBy = sorting ASC
  }
  renderObj = IMAGE
  renderObj {
    file {
      import = uploads/pics/
      import.field = image
      import.listNum = 0
    }
  }
}

NOTE : The renderObj is just my example and it renders only the first image of the Image element. You can set the rendering as you please, eg set the file to be GIFBUILDER which would allow you to resize the image. You can also tweak the select to load content elements with more refined conditions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM