Image Size.
Posted: Wed Oct 05, 2005 3:20 am
Here is the first PHP that I have struggled to put together, I want to output an XML file to read into Flash. The PHP successfully reads the file name and size of the file.
I want to add one other peice of functionality if its possible. Can I say some where in this PHP, if the image is over a Y_height, myNewHeight is Z_height?
Basically I want to resize an image on the server, if its to large to display in my Flash file. Is this possible?
I want to add one other peice of functionality if its possible. Can I say some where in this PHP, if the image is over a Y_height, myNewHeight is Z_height?
Code: Select all
<?php
echo "<?xml version=\"1.0\" encoding =\"ISO-8859-1\" ?>\n";
echo "<images>\n";
if ($handle = opendir('images')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
list($width, $height) = getimagesize("images/".$file);
echo "<myImage myPath=\"images/" . "$file\"" . " myWidth=\"" . "$width\"" . " myHeight=\"". "$height\"" ." />\n";
}
}
closedir($handle);
}
echo "</images>\n"
?>