Closed Thread Icon

Preserved Topic: Passing image files in PHP Pages that link to <a href="https://ozoneasylum.com/backlink?for=21195" title="Pages that link to Preserved Topic: Passing image files in PHP" rel="nofollow" >Preserved Topic: Passing image files in PHP\

 
Author Thread
butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 04-02-2002 13:03

Sorry about the title, I wasn't sure what to call this one.

I'm writing a script that takes a .zip file upload, uses the exec() function to unpack it to the "photos" directory, then opens that directory with opendir() and passes each file to a function that uses another exec() function to make a thumbnail of the photo and put it in the "thumbnail" directory.

All this works except for one thing, the files that show up in the "thumbnails" directory are of 0 length. The files I expect to show up there do, they just don't have anything to them.

I get the feeling it's because I'm working with image files and opendir() -> readdir() is not the proper way to try and work with images.

Could someone please point me in the right direction?

Just in case you need (or want) to see the code I've posted it Here. Forgive the mess, I'm still playing around with the code and the logic.

Thanks

-Butcher-

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 04-02-2002 13:27

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 04-02-2002 14:25

No, they have unzipped just fine.

I still think it's how I'm passing them along to my "thumbnail" function, which I've tested by itself and I know works.


-Butcher-

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 04-02-2002 14:54

btw, what are these strange pnm and ppm images?
are these netbpm specific file formats?

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 04-02-2002 15:33

Grumble

Yes they are. To work with the netPBM programs you have to convert the images to the netPBM format, do what your going to do, and then convert them back to the format that you want.

-Butcher-

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 04-02-2002 15:45

ah. thanks for the explanaition.

so whats pnm ad whats ppm?

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 04-02-2002 16:28

pnm is a generic file name that recognizes and distinguishes between three different netpbm file formats.

pbm - Black and White

pgm - Shades of gray

ppm - Full color

Hope this helps

-Butcher-

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 04-02-2002 16:33

oh yeah!
thanks very much!

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 04-02-2002 17:09

Alrighty.

Let's see, you said the thumbnails are getting created correctly and just not transferred to the directory correctly?

Where are the thumbs that you can see?

It sounds like the file transfer part is actually correct, it's the thumbnail creation part that's broke.

Where are



.:[ The Tao of Steve ]:.
Be Desireless
Be Excellent
Be Gone
...................................

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 04-02-2002 17:28

No, let me see if I can put it better.

I built the thumbnail function first and tested it one picture at a time, and it created the thumbnail and placed it in the proper directory. All was fine.

Then I set out to add the extra functionality to be able to upload a zip file. The code works fine except that the files that show up in the thumbnail directory, although named correctly, have no information in them (0 kb).

If I still didn't clear it up well enough, please say so and I'll try again.

-Butcher-

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 04-02-2002 18:33

Hokay check this out.

First according to the most recent docs from php.net your while loop is wrong but let's change it to this anyway
But the biggie.
you're only sending the file name to the thumbnail function you're not sending the whole path to the file

code:
$directory_name = "/home/my_place/public_html/test_gallery/$new_album";
$dh = opendir($directory_name);
while (false !== ($entry = readdir($dh)))
{
thumbnail($directory_name.$entry, $new_album);
}
closedir($dh);






.:[ The Tao of Steve ]:.
Be Desireless
Be Excellent
Be Gone
...................................

[This message has been edited by bitdamaged (edited 04-02-2002).]

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 04-02-2002 21:55

Thanks Bitdamaged!!

You were absolutly right, all I had to do was make one little adjustment to what you gave me and it worked like a charm!!

code:
thumbnail($directory_name."/".$entry, $new_album);



Just needed the / inbetween.

Thanks man!

-Butcher-

« BackwardsOnwards »

Show Forum Drop Down Menu