get image and swf dimensions with coldfusion

Posted on 2006-05-12
Last Modified: 2013-12-20
Is there a way to check the dimensions of an image or a swf file on your server. I am building a banner management application and I want it to add the height and width of a banner to the database when a banner gets uploaded throught the form using cffile. I want this to be an automated feature so the client does not have to add them in their self. Any advice as where to start on this would be great.
Question by:siva350
    LVL 35

    Accepted Solution


    <cfobject type="JAVA" action="Create" name="tk" class="java.awt.Toolkit">
    <cfobject type="JAVA" action="Create" name="img" class="java.awt.Image">
    img = tk.getDefaultToolkit().getImage(fname);
    width = img.getWidth();
    height = img.getHeight();

    Or use a nice tag like those linked to from here:
    LVL 3

    Author Comment

    will this work with a flash banner?
    LVL 35

    Expert Comment

    I don't know
    LVL 3

    Author Comment

    mrichmon, thanks for your help, I found a cfc that I think will work for the flash but it looks like your answer will do the trick for the gifs and jpg so I will be back shortly to let you know if it all worked and post a link to the cfc if it does work
    LVL 3

    Author Comment

    this code does not seem to work, can you tell me what I need to change?
    LVL 3

    Author Comment

    nevermind, Im a moron and forgot to put the file path in the code. oops

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Remove Index.php in Codeigniter 12 46
    Web Data Entry Application 5 76
    question about access to website 2 47
    CFFILE upload help 98 88
    When deciding to adopt any help desk solutions many factors should be explored before taking decisions. This will change from business to another but in general there are some kind of rule of thumb. Here are some quick tips: Do we need only ticket…
    A web service ( is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
    The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: : Open Page or Post…
    The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now