PHP: How to retrieve the pixel dimensions of a jpeg file on disk

Posted on 2007-10-10
Last Modified: 2007-10-10
PHP: JPEG pixel dimensions

In PHP, i have Jpeg files that i'm displaying and i need to know the pixel dimensions.
What built-in function call can i use to return the pixel H & W of the image.
(clarification:  this is not file size)

I've looked thru imagemagick but cannot find anything that does this.


Question by:willsherwood
    LVL 20

    Accepted Solution

    <?php list($w, $h) = getimagesize("Images.jpg") ?>
    LVL 20

    Expert Comment

    for more details read

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    The viewer will learn how to count occurrences of each item in an array.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    734 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

    21 Experts available now in Live!

    Get 1:1 Help Now