468,107 Members | 1,359 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,107 developers. It's quick & easy.

How to find Image Height and width using PHP saved as Excel?

aveeva
33
I have a folder with 100's images, how to find Height and width programmatically and output saved in Excel sheet?
Apr 30 '19 #1
3 857
gits
5,390 Expert Mod 4TB
well - the idea is

1 .to loop over all files in that folder - probably checking if the element is a file (and not a folder or non valid image) - then check the mimetype or some other fileinfo - and identify if its a valid image you want to handle then

2. you can use getimagesize to retrieve the image dimensions then

3. store that for now in some result-structure (array or object - whatever you like to use) then

4. use something like PhpSpreadsheet to create your spreadsheet from the result-structure
Apr 30 '19 #2
Luuk
1,043 Expert 1GB
A, slighty more simple, way would be to skip step 3 and 4. Echo the values to output and create a CSV-format like:
Expand|Select|Wrap|Line Numbers
  1. picture1.jpg,1280,1024
  2. picture2.jpg,1920,1080
  3. picture3.jpg,1080,1920
Excel is your friend here. you do not need to create an excel file, because Excel is capable of reading CSV-files very well.

But, if you want to be an expert in PHP, than you should not skip steps 3 and 4 😂😉
Apr 30 '19 #3
gits
5,390 Expert Mod 4TB
that might be :) usually a developers work should be to question the requirements as well - thus i agree with the csv-file creation - which is most likely even a bit more universal.
Apr 30 '19 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Ana | last post: by
1 post views Thread by Blake Versiga | last post: by
1 post views Thread by Mustafa Rabie | last post: by
1 post views Thread by Nathan Sokalski | last post: by
1 post views Thread by comp.lang.php | last post: by
18 posts views Thread by pecan | last post: by
8 posts views Thread by Kentor | last post: by
2 posts views Thread by Atul | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.