Jpeg preloader form php [flash mx]

Hello everyone,
I tried to do a search but I couldn’t find anything that addressed this.

I am using a premade gallery app… ImageVue Demo

My client does not want images to show up bigger than the movie clip, thus needing to scroll. So I modified the code in PHP and changed the loadmovie action to imitate the thumbnail loader. Only now the loading progress is dead. Everything loads fine, just the loader dies.

I can’t remember the link but I read something about a problem loading dynamic xml into a movie so I tried that solution, buffering the output. Same result. If I just change the loadmovie back and remove the php file everything works fine, is there a solution to this?

Oh yeah, if I load the image just by typing in the url, it works fine, like this, only not the thumb… direct image

Code follows…

load call…
[AS]loadMovie((“getfile.php?img=”+_parent.prepath+_parent.file + “&size=default”), _parent.mytarget);[/AS]

loader code (kinda long, I’m not sure if I should strip anything out)…
[AS]onClipEvent (enterFrame) {
myload = _parent.mytarget.getBytesLoaded();
mytotal = _parent.mytarget.getBytesTotal();
mypercent = Math.round((myload/mytotal)*100);
bar._xscale = mypercent;
percent = mypercent+" %";
if ((myload == mytotal) and (myload>1000) and (_parent.mytarget._width>0)) {
_parent.firstimagesuccess=1;
//new write filename
_parent.nutopText = "image “+(_parent.image+1)+” - "+_parent.file;
_parent.testhead.text = _parent.nutopText;
_parent.testlength = _parent.testhead.textWidth;
//
_parent.thumbnailtoggler._visible = 1;
if (_parent.mytarget._width<=640) {
_parent.wsmall = 1;
_parent.mytarget._x = -(_parent.mytarget._width-640)/2+31;
} else {
_parent.mytarget._x = 31;
_parent.wsmall = 0;
}
if (_parent.mytarget._height<=360) {
_parent.hsmall = 1;
_parent.mytarget._y = -(_parent.mytarget._height-360)/2+39;
} else {
_parent.mytarget._y = 39;
_parent.hsmall = 0;
}
_parent.tsmall = _parent.hsmall+_parent.wsmall;
_parent.desc = _parent._parent.image.firstChild.childNodes[_parent.image].firstChild.nodeValue;
_parent.thumbfield = _parent._parent._parent.thumbnailofftext;
_parent.cachearray[_parent.image]=1;
_parent.thumbindex = 0;
_parent.filedisplay = _parent.file.toUpperCase();
_parent.display = “image “+(_parent.image+1)+”/”+_parent._parent.imagearray.length;
_parent.multibuttons.multi[“clip”+_parent.image]._alpha = 50;
_parent.cover.transout();
_parent.gotoAndStop(_parent._currentframe+1);
}
}[/AS]

and the php file…

$img=$_GET['img'];
if (isset($_GET['size'])) { $size=$_GET['size']; }
$path = substr($img, 0, strrpos($img, '/'));
$file = substr($img, strrpos($img, '/') + 1);

$tnpath = $path . '/tn_' . $file;
$defPath = $path . '/def_' . $file;


if (@file_exists($defPath)) {
	    Header("Content-type: image/jpeg");
	    readfile($defPath);
	} elseif (!file_exists($img)) {
	    die("Image doesn't exist");
	} else {
	    if (function_exists("imagecreatefromjpeg") and function_exists("imagecreatetruecolor")) {
	        $orig_image = imagecreatefromjpeg($img);
	        $orig_x = imagesx($orig_image);
	        $orig_y = imagesy($orig_image);
			if ($orig_y > 344) {
				$x = round($orig_x / ($orig_y / 344));
	            $y = 344;
				$def_image = imagecreatetruecolor($x, $y);
		        Imagecopyresampled($def_image, $orig_image, 0, 0, 0, 0, $x, $y, $orig_x, $orig_y);	        
				Header("Content-type: image/jpeg");
		        imageJPEG($def_image, '', 100);
				@imageJPEG($def_image, $defPath, 100);
		        imagedestroy ($def_image);
		        imagedestroy ($orig_image);
			} else {
				Header("Content-type: image/jpeg");
			    readfile($path . '/' . $file);
			}
	    } else {
	        header("Content-type: image/jpeg");
	        readfile ('thumb.jpg');
	    } 
	}

The big problem with testing is, since it’s using a web server, and the AS isn’t written for it, trying to test the movie just doesn’t load the images and menu cause it can’t do the php calls.

I really need help with this one, please… :slight_smile: thanks.