Image Size.

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!

Moderator: General Moderators

Post Reply
Blyant
Forum Newbie
Posts: 12
Joined: Fri Sep 30, 2005 8:14 am

Image Size.

Post 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?
yacozaragoza
Forum Newbie
Posts: 4
Joined: Wed Oct 05, 2005 12:01 am
Location: Florida

Post 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..
Post Reply