Greetings all-
I'm using php's zip_open() functions to parse through a zip file of images. I need to get the width and height of each image in the zip file. I'm having problems doing this.
I'm able to loop through the zip file and get each image and upload it to an Oracle database table. But, when adding in code to get an image size, I can't get anything to work.
My code, in part is below, so you can see what I have as far as file names.
Any help would be appreciated.
# code in part
# $zipfile_path_name is temp dir where uploaded zip is stored temporarily
$zip = zip_open(realpath($zipfile_path_name));
while( $zip_entry = zip_read($zip) ){
$zip_name = zip_entry_name($zip_entry);
$image_file_size = zip_entry_filesize($zip_entry);
if( preg_match('/(\.jpg)|(\.jpeg)|(\.gif)/', $zip_name) ){
$file=null;
if( zip_entry_open($zip, $zip_entry) ){
$file = zip_entry_read($zip_entry, $image_file_size);
zip_entry_close($zip_entry);
// my other processing code is here...
}
}
}
Regards,