Page 1 of 1

Image Size.

Posted: Wed Oct 05, 2005 3:20 am
by Blyant
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?

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"

?>
Basically I want to resize an image on the server, if its to large to display in my Flash file. Is this possible?

Posted: Wed Oct 05, 2005 11:54 am
by yacozaragoza
Are all the images the same size? when they are showing in the flash ?

if not you can set the Width and Height as variables and have them imorted with the image name..