PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm trying to create a script that will get all the pictures within a directory, and thorw them onto a page. The directory is local (as in on the same server where php is), and I can assume will be chmod'ed 777. The path will be known. Also, I will need to get the names of the pictures into some kind of array, so I can do a mass resize using GD. Something like:
$pics = //array of picture names
for ($i=0; $i<=sizeof($pics)-1; $i++){
resize($pics[$i]); //my own function
save($pics[$i], "newname".$i.".jpg"); //my own function
chmod ("newname".$i.".jpg", 0777)
}
glob() the folder, interate over each checking it first if it is_file() and getimagesize() if so to verify it is an image. Add it to the array. Repeat until you run out of entries in the return from glob().
Also on some servers, I have seen such scripts 'crash' with an CGI Error ("...not returning a complete set of HTTP headers...") when glob could not find any match!
Oh, wow! This is awsome, you guys are the best! Thanks. A premade script won't do it btw because I'm integrating this into a website, but this will amke it much easier for me. Thanks very much! I'll keep the case-sensitive part in mind.
Evil Monkeys Signature wrote:Young people of Toronto: Prepare to be blown away!
I'm young and from Toronto.. and waiting to be blown away
I can't say exactly what I'm working on, I can only say that I'm about 95% done (this has been in development for the last 1.5 years, and featured both technical and social development). It shoudl be up in a month tops.