Skip to main content
Participating Frequently
May 12, 2010
Question

get image resolution (dpi)

  • May 12, 2010
  • 1 reply
  • 711 views

Hello,

Is there a way to get the image resolution or dpi?

I have tried something like this:

<cfimage action="read" source="files/HK1002010-0849.jpg" name="myImage" />
<cfset exif = ImageGetEXIFMetadata(myImage) />
<cfdump var="#exif#" label="Exif Metadata">
<cfdump var="#myImage#" label="Exif Metadata">

<hr />

<cfoutput>
#ImageGetEXIFTag(myImage, "X Resolution")#
</cfoutput>

but it's shows 72 at all times, so also when an image is 300dpi, it shows 72.

Can someone help me?

Thanks!

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    May 13, 2010

    http://www.leavethatthingalone.com/blog/index.cfm/2007/7/18/ColdFusion8_Exif_and_IPTC

    <cfimage action="read" source="IMG_2479.JPG" name="myImage" />

    <cfset exif = ImageGetEXIFMetadata(myImage) />

    <cfdump var="#exif#" label="Exif Metadata">

    Ken Ford

    Participating Frequently
    May 13, 2010

    Hi Ken,

    Thanks for your reply. That script is not working completly. It alway returns 72DPI, also on a 300DPI picture. I have bought a cfx tag to accomplish this.

    I do have an other question. I want to open the file in Photoshop, while photshop is not the default program for JPG files. I have something like this:

    <cfheader name="Content-Type" value="unknown">
    <cfheader name="Content-Disposition" value="attachment; filename=#URL.File2Download#">
    <cfcontent type="Application/photoshop" file="#application.serverPath#\files\#URL.File2Download#" deletefile="No">

    which is not working. Can someone help me on this one?

    Thanks!