Jump to content

[SOLVED] Getting image data


webent

Recommended Posts

Hi, it's very easy for me to get image data when I am uploading images, I guess the whole "enctype="multipart/form-data"" takes care of that, because I can then retrieve the "name, type, and size" of the image...

 

My problem is, what if the images are already uploaded, how do I break the image up into an array to get it's "name, type, and size" properties?

 

$dirname = "/home/username/public_html/storage/images/";
$pattern = "(\.gif$)|(\.GIF$)|(\.jpg$)|(\.JPG$)|(\.jpeg$)|(\.JPEG$)|(\.png$)|(\.PNG$)|(\.bmp$)|(\.BMP$)";
$files = array();
if (isset($_POST['insert_images'])) {
    if ($handle = opendir($dirname)) {
        while(false !== ($files = readdir($handle)))	{
            if(eregi($pattern, $files)) {
            //insertImages($files);
            echo '<pre>';
            print_r ($files);
            echo '</pre>'; 
            }
        }   
    }
    closedir($handle);
}

Link to comment
https://forums.phpfreaks.com/topic/111754-solved-getting-image-data/
Share on other sites

I don't get it. First you say

I guess the whole "enctype="multipart/form-data"" takes care of that, because I can then retrieve the "name, type, and size" of the image...

 

but then you say

 

how do I break the image up into an array to get it's "name, type, and size" properties?

 

so...first you say you got it, then you say you don't...so which is it?

When I upload images, I can get their data, I assume because of the "enctype="multipart/form-data""...

 

My problem is that I have a folder full of thousands of images that are already uploaded, and I want to extract their data... they're already uploaded, so I don't get the benefit of "enctype="multipart/form-data"" doing it's job of breaking my file up...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.