2 Replies Latest reply on Oct 4, 2007 9:53 AM by cfcolorado

    Using cfimage to get height and width

    cfcolorado
      Is it possible with cfimage to get the height and wdith of an image to set to a var? I can use CFX_ImageInfo but I was hoping to use cfimage to handle everything. It seems that the height and width attributes are used for setting the attributes and not displaying what they are.


      Thanks!
        • 1. Re: Using cfimage to get height and width
          Level 7
          If you are trying to return the image dimensions, there is always
          imageGetHeight() and imageGetWidth() functions, or, using the cfimage tag
          with an attribute of action="info" you can return a struct with heaps of
          info, including the dimensions. From the live docs:
          <!--- This example shows how to retrieve and display image information. --->
          <cfimage source="../cfdocs/images/artgallery/viata03.jpg" action="info"
          structName="viatoInfo">
          <cfdump var="#viatoInfo#">

          <!--- Alternatively, you can use the cfoutput tag to display specific image
          information, as
          shown in the following example. --->
          <cfoutput>
          <p>height: #viatoInfo.height# pixels</p>
          <p>width: #viatoInfo.width# pixels</p>
          <p>source: #viatoInfo.source#</p>
          <p>transparency: #viatoInfo.colormodel.transparency#</p>
          <p>pixel size: #viatoInfo.colormodel.pixel_size#</p>
          <p>color model: #viatoInfo.colormodel.colormodel_type#</p>
          <p>alpha channel support:
          #viatoInfo.colormodel.alpha_channel_support#</p>
          <p>color space: #viatoInfo.colormodel.colorspace#</p>
          </cfoutput>

          "cfcolorado" <webforumsuser@macromedia.com> wrote in message
          news:fdu317$6ll$1@forums.macromedia.com...
          > Is it possible with cfimage to get the height and wdith of an image to set
          > to a
          > var? I can use CFX_ImageInfo but I was hoping to use cfimage to handle
          > everything. It seems that the height and width attributes are used for
          > setting
          > the attributes and not displaying what they are.
          >
          >
          > Thanks!
          >


          • 2. Re: Using cfimage to get height and width
            cfcolorado Level 1
            Perfect, thanks Lossed!