Login / Status
developer.Resource
Home . Documentation . Document Library
Sponsors
hosted by punkt.deTYPO3 and Open Source MagazineMittwald

5.2. imgResource:

imgResource is properties that is used with the data type imgResource.

Example:

This scales the image toplogo.gif to the width of 200 pixels

file = toplogo.gif
file.width = 200

Property:

Data type:

Description:

Default:

ext

imageExtension /stdWrap

web

width

pixels /stdWrap

If both the width and the heigth are set and one of the numbers is appended by an "m", the proportions will be preserved and thus width/height are treated as maximum dimensions for the image. The image will be scaled to fit into width/height rectangle.

If both the width and the heigth are set and at least one of the numbers is appended by a "c", cropscaling will be enabled. This means that the proportions will be preserved and the image will be scaled to fit around a rectangle with width/height dimensions. Then, a centered portion from inside of the image (size defined by width/height) will be cut out.

The "c" can have a percentage value (-100 ... +100) after it, which defines how much the cropping will be moved off the center to the border.

Notice that you can only use “m” or “c” at the same time!

Examples:

This crops 120x80px from the center of the scaled image:

.width = 120c.height = 80c

This crops 100x100px; from landscape-images at the left and portrait-images centered:

.width = 100c-100.height = 100c

This crops 100x100px; from landscape-images a bit right of the center and portrait-images a bit upper than centered:

.width = 100c+30

.height = 100c-25

height

pixels /stdWrap

see “.width”

params

string

ImageMagick command-line:

fx. "-rotate 90" or "-negate"

sample

boolean

If set, -sample is used to scale images instead of -geometry. Sample does not use antialiasing and is therefore much faster.

alternativeTempPath

string

Enter an alternative path to use for temp images. Must be found in the list in TYPO3_CONF_VARS[FE][allowedTempPaths]

frame

int

Chooses which frame in an gif-animation or pdf-file.

"" = first frame (zero)

import

path /stdWrap

value should be set to the path of the file

with stdWrap you get the filename from the data-array

Example:

This returns the first image in the field "image" from the data-array:

.import = uploads/pics/

.import.field = image

.import.listNum = 0

maxW

pixels /stdWrap

Max width

maxH

pixels /stdWrap

Max height

minW

pixels

Min width (overrules maxW/maxH)

minH

pixels

Min height (overrules maxW/maxH)

Masking:

(Black hides, white shows)

   

m.mask

imgResource

The mask by which the image is masked onto "m.bgImg". Both "m.mask" and "m.bgImg" is scaled to fit the size of the imgResource image!

NOTE: Both "m.mask" and "m.bgImg" must be valid images.

m.bgImg

imgResource

NOTE: Both "m.mask" and "m.bgImg" must be valid images.

m.bottomImg

imgResource

An image masked by "m.bottomImg_mask" onto "m.bgImg" before the imgResources is masked by "m.mask".

Both "m.bottomImg" and "m.bottomImg_mask" is scaled to fit the size of the imgResource image!

This is most often used to create an underlay for the imgResource.

NOTE: Both "m.bottomImg" and "m.bottomImg_mask" must be valid images.

m.bottomImg_mask

imgResource

(optional)

NOTE: Both "m.bottomImg" and "m.bottomImg_mask" must be valid images.

[tsref:->imgResource]