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

Posted on 2007-10-10
Medium Priority
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
  • 2
LVL 20

Accepted Solution

Gawai earned 2000 total points
ID: 20048772
<?php list($w, $h) = getimagesize("Images.jpg") ?>
LVL 20

Expert Comment

ID: 20048788
for more details read

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

840 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