Get image height and width during/after upload

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
RKwasi
Posts: 11
Joined: 2016-03-26T17:07:28-07:00
Authentication code: 1151

Get image height and width during/after upload

Post by RKwasi »

Is it possible to get the width and height of an image during or right after it gets uploaded to a server but "before" it gets viewed in a browser etc

I need to write the filename, width, and height of uploaded photos into a database.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Get image height and width during/after upload

Post by fmw42 »

You will need to run a script on receipt of the image to your server input folder that is launched by new data arriving. This has nothing to do with Imagemagick other than to get the dimension. You need to check your server tools for a notifier of new data to some folder and then launch a script to call Imagemagick to get the dimensions.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Get image height and width during/after upload

Post by Bonzo »

JavaScript may be able to get the information before upload but I am not a JavaScript user.

You can get the information in php with getimagesize() but only when the image is on the server. This can be part of your upload script and save data to the database.
Post Reply