typo3 TypoScript Image and Image Resource


Example

Get image from file

lib.myImage = IMAGE
lib.myImage.file = fileadmin/My-Image.png
lib.myImage.file.width = 100
lib.myImage.file.height = 100

Get image from page properties

lib.pageImage = IMAGE
lib.pageImage {
    file.import.data = levelmedia: -1, "slide"
    file.import = uploads/media/
    file.import.listNum = 0
    file.import.override.field = media

    border = 0
    altText = xy
    titleText = xy
}

get images from page resources (FAL)

lib.pageResources = FILES 
lib.pageResources { 
  references { 
    table = pages 
    uid.data = uid
    fieldName = media
  } 
  renderObj = IMAGE 
  renderObj {
    file { 
      import.data = file:current:uid 
      treatIdAsReference = 1 
      width = 150c 
      height = 150c 
    } 
    altText.data = file:current:alternative
    titleText.data = file:current:title
  } 
  maxItems = 3
}

Get image resource

lib.myImage = IMAGE
lib.myImage.file = fileadmin/My-Image.png
lib.myImage.file.width = 100
lib.myImage.file.height = 100
lib.myImage.stdWrap.wrap (
 <div style="background-image:url(|); width:100px; height:100px;">Headline</div>
)

Get images from content elements

lib.ceImages = FILES
lib.ceImages {
    stdWrap.wrap = <div class="pic">|</div>
    references {
        table = tt_content
        // current CE (needs context)
        #uid.data = uid
        // for CSC
        fieldName = image
        // for FSC
        fieldname = assets
    }
    renderObj = IMAGE
    renderObj {
        file {
            import.data = file:current:uid
            treatIdAsReference = 1
            width = 150c
            height = 150c
        }
        altText.data = file:current:alternative
        titleText.data = file:current:title
        stdWrap.typolink.parameter.data = file:current:link
    }
    maxItems = 5
}