hello,
i want to load external images in my flash websites.
the images are thumbnails generated by php.
but it seems that flash doesn’t properly detects the file size.
any suggestions?
kind regards,
dnd
<?php
ob_start();
$image = $_GET["img"];
$project = $_GET["project"];
$h="400";
$w="680";
$image="../data/projects/".$project."/".$image;
$max_width = $w;
$max_height = $h;
$size = getimagesize($image);
$width = $size[0];
$height = $size[1];
$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;
if ( ($width <= $max_width) && ($height <= $max_height) ) {
$tn_width = $width;
$tn_height = $height;
}
else if (($x_ratio * $height) < $max_height) {
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
}
else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
$src = imagecreatefromjpeg($image);
$dst = imagecreatetruecolor($tn_width,$tn_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0,
$tn_width,$tn_height,$width,$height);
header("Content-type: image/jpeg");
imagejpeg($dst, null, 100);
imagedestroy($src);
imagedestroy($dst);
header("Content-Length: ". ob_get_length());
// flush the output
ob_end_flush();
?>