2016-10-11 3 views
1

내 메뉴에서 스크립트를 사용하여 페이지의 리소스에로드 된 이미지를 검색하고 있습니다.Typoscript 메뉴 이미지 크기

이제 이미지를 크기 조정/잘린 크기로 만들 필요가 있습니다. 작동시키기 위해 너비와 높이를 어디에 추가 할 수 있습니까?

NO { 
    wrapItemAndSub = <li>|</li> 
    stdWrap.cObject = COA 
    stdWrap.cObject { 
    10 = TEXT 
    10.field = title 
    10.wrap = <span>|</span> 
    20 = FILES 
    20 { 
     # Get the images related to the current page 
     references { 
     table = pages 
     fieldName = media 
     } 
     # Render each image and wrap it as appropriate 
     renderObj = TEXT 
     renderObj { 
     typolink { 
     parameter.data = file:current:publicUrl 
     forceAbsoluteUrl = 1 
     returnLast = url 
     } 
     wrap = |, 
    } 
    stdWrap { 
     # Take only the first image if several are defined 
     listNum = 0 
     # Use default image if none is available 
     ifEmpty.cObject = TEXT 
     ifEmpty.cObject.typolink { 
     parameter = fileadmin/templates/example/images/placeholder.png 
     forceAbsoluteUrl = 1 
     returnLast = url 
     } 
     wrap = <div><img src="|" /></div> 
     } 
    } 
    } 
} 

답변

2

이미지가 교체 renderObj = TEXT

renderObj = IMG_RESOURCE을 통해 예 :

NO { 
    wrapItemAndSub = <li>|</li> 
    stdWrap.cObject = COA 
    stdWrap.cObject { 
    10 = TEXT 
    10.field = title 
    10.wrap = <span>|</span> 
    20 = FILES 
    20 { 
     # Get the images related to the current page 
     references { 
     table = pages 
     fieldName = media 
     } 
     # Render each image and wrap it as appropriate 
     renderObj = IMG_RESOURCE 
     renderObj { 
     file.import.data = file:current:uid 
     file.treatIdAsReference = 1 
     file.width = 250c 
     file.height = 250c 
     wrap = |, 
     } 
     stdWrap { 
     # Take only the first image if several are defined 
     listNum = 0 
     # Use default image if none is available 
     ifEmpty.cObject = TEXT 
     ifEmpty.cObject.typolink { 
      parameter = fileadmin/templates/example/images/placeholder.png 
      forceAbsoluteUrl = 1 
      returnLast = url 
     } 
     wrap = <div><img src="|" /></div> 
     } 
    } 
    } 

하나의 이미지 만 렌더링하려면 먼저 모든 이미지 목록을 만들어서는 안됩니다. maxItems 설정을 FILES으로 사용하고 listNumstdWrap에서 제거하십시오.

20 = FILES 
20 { 
    ... 
    maxItems = 1 
    ... 
} 
+0

감사합니다. – user500665

0

GIFBUILDER를 사용해야한다고 생각합니다. GIFBUILDER는 예를 들어 ImageMagick에 이미지를 전달하고 필요에 따라 이미지를 잘라내거나 확대/축소하는 데 도움이됩니다.

뭔가

lib.image = IMAGE 
lib.image { 
    file = GIFBUILDER 
    file { 
    #use the c in XY to crop 
    XY = 1024c,768c 
    format = jpg 
    10 = IMAGE 
    10.file = fileadmin/image.jpg 

    } 
} 

처럼 여기 Gifbuilder에 대한 자세한 내용을보실 수 있습니다 : 당신은 크기를 조정하려면

https://docs.typo3.org/typo3cms/TyposcriptReference/Gifbuilder/Index.html

+0

이미지 크기를 조정할 때'''GIFBUILDER'''를 실행할 필요가 없습니다. 콘텐츠 요소''''IMAGE''와''''IMG_RESOURCE''는 또한 이것을 할 수 있으며'''GIFBUILDER''와 같이 많은 메모리와 처리 시간을 필요로하지 않습니다. –