How to output the height and width of an Image TV

on 13-Sep-2009 | Comments ( 2 ) Tags: Evolution


Create the width phx extender

Create a new snippet phx:width and paste the following code:

list($width, $height,$type,$attr) = getimagesize($output);
return $width;

Create the height phx extender

Create a new snippet phx:height and paste the following code:

list($width, $height, $type, $attr) = getimagesize($output);
return $height;

Use with Ditto or other snippets

<img src="[+imageTV+]" alt="" width="[+image:width+]" height="[+image:height+]" />

Direct TV output

<img src="[*imageTV*]" alt="" width="[*image:width*]" height="[*image:height*]" />


I was amazed at how simple it was to do this in modx. If you know other solutions leave a comment.

Write a comment

  • Required fields are marked with *.

If you have trouble reading the code, click on the code itself to generate a new random code.
Posts: 2
How to output the height and width of an Image TV
Reply #2 on : Wed December 09, 2009, 13:49:52
$info = getimagesize($output);
return = $info['3'];
Will return
width="xx" height="xx"
Posts: 2
Image modifiers for Phx
Reply #1 on : Thu December 10, 2009, 10:58:44
Regarding a very near subject, I have proposed to integrate this kind of modifiers in the parser. See,43102.0.html#new
Hope this integration will be done with the next release of phx

Thanks for sharing your articles

Quick modx Evolution Tags

  • cached [[snippet]] or uncached [!snippet!]
  • {{chunk}}
  • [+placeholder+]
  • [*resourceField/TV*]
  • [^timing^]
  • [~link~]

Quick modx Revolution Tags

  • [[snippet]]
  • [[$chunk]]
  • [[+placeholder]]
  • [[*resourceField/TV]]
  • [[~link]]
  • [^timing^]
  • [[++systemSetting]]
  • [[%languageStringKey]]
  • all tags can be called un-cached like: [[! snippet]]

Timing Tags (Evo and Revo)

  • [^qt^] - Query time
  • [^q^] - Query count
  • [^p^] - Parse time
  • [^t^] - Total time
  • [^s^] - Source
© modxRULES! 2009-2014