Actions

Template

Difference between revisions of "Cropimage"

From Sonic Retro

 
(One intermediate revision by one other user not shown)
Line 6: Line 6:
 
height:{{#if: {{{height|}}} |{{#expr:{{{height}}}*{{#var:scale}}}}px|auto}};
 
height:{{#if: {{{height|}}} |{{#expr:{{{height}}}*{{#var:scale}}}}px|auto}};
 
line-height:0px"><div style="
 
line-height:0px"><div style="
{{#if: {{{sprite|}}} | image-rendering:-moz-crisp-edges; -ms-interpolation-mode:nearest-neighbor; |}}
+
{{#if: {{{sprite|}}} | image-rendering: pixelated; |}}
 
position:relative;
 
position:relative;
 
top:-{{#expr:{{#if:{{{y|}}}|{{{y}}}|0}}*{{#var:scale}}}}px;
 
top:-{{#expr:{{#if:{{{y|}}}|{{{y}}}|0}}*{{#var:scale}}}}px;
Line 37: Line 37:
 
* "sprite=yes" disables filtering.
 
* "sprite=yes" disables filtering.
  
[[Category:Sonic Retro templates]]
+
[[Category:Templates]]

Latest revision as of 13:50, 30 June 2022

This template will display part of an image.

Usage

{{cropimage
| image=
| width=
| height=
| x=
| y=
| float=
| scale=
| sprite=
| nolink=
}}
  • All parameters are optional except "image".
  • "width" and "height" refer to the crop area (the area of the image which remains visible), not the size of the image itself. The image is not resized.
  • "x" and "y" are distances from the left and top edges of the image where the visible area begins.
  • "float" can be left or right.
  • "scale" enlarges or shrinks the image by that factor (i.e. 2 will double the image size).
  • "sprite=yes" disables filtering.