Lost and I are looking for php script which will look into a file folder, returning the number of pictures in that file folder, their names, and their dimensions. If anyone could help us out with developing these functions we would greatly appreciate it. (plus you’re name will be in the code where ever we use it, adding the the prestige. )
I have this so far…
<?php
$dir = opendir("images");
while (false != ($file = readdir($dir))) {
if ($file == "." || $file == "..") continue;
echo ("$file<BR>");
}
?>
And that works all well and good, but how do I get the image dimensions as well? I tried, but it kept telling me there was an error with it, but I looked it up and I was using it right! I was wondering if I had to CHMOD the files, if so… one server I am on won’t let me do it, while the other server is being PHP retarded so I hope not.
When I get home I’ll attempt the get image size method on my server, with Chmod checked. I’ll let you know if I have any luck.
Thanks david.
Howdy…
Some code snippet from my old file that goes with the file dimension…
$destinationFile = "./" . $theImageNum . ".jpg";
$picsize = getimagesize("$destinationFile");
$source_x = $picsize[0];
$source_y = $picsize[1];
echo($source_x . " : " . $source_y);
I’m not sure if it is viable though since PHP needs to open up the graphic file to get the dimension information… Maybe there is better way to do it???
Good luck… :cowboy:
Something like:
<?php
$dir = opendir(".");
while($file = readdir($dir)){
if($file=="." or $file=="..") continue;
$dotposition = strrpos($file, ".");
$filename = substr($file, 0, $dotposition);
$extension = substr($file, 1 + $dotposition);
if($extension == "jpg" || $extension == "gif"){
$size = getImageSize($file);
echo "$filename.$extension height = $size[1] width = $size[0] <BR>";
}
}
?>
[edit] didn’t see CyanBlue’s post [/edit]
Just 3 minutes early… Being lazy sometimes does trick… I was too lazy to sum up the total and yet, you did all the job, h88… :A+:
WOW!! Thanks guys!!
You know whats funny… what I was doing last night DID work… but it turns out your have to have the php file in the same directory as the images, I had it in the parent directory. 'DOH!
I will work a bit more with this to try and get it to do what I want, but don’t be surprised if I come back here begging for mercy/help
That’s why I’ve been telling you that you need to get some sleep… :bad:
Well it was only 4:39am :sigh:
Well… That sounds about right… Never go to bed before the sun rises, eh??? =)
Us vampires do that :goatee:
Yes, we do that… I’m glad that it’s raining now… No sun up there… :evil:
MMMWWWWWAAAAHAHAHAHA
I wish it was thundering too… I like thunder :sleep:
sweet work guys.