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
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?

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.