Resize a PHP image

Hi,

I’ve looked through most of the monster resize thread, but I can’t see anything related to my cause, maybe there is too much to find it in there :puzzle:

I have a a 160x120 swf which loads random jpgs via PHP into my movieclip key1

I don’t know the sizes of the images that will be in the folder PHP searches, but they will be of similar proportions and I can’t figure out how I can resize the images to fit my stage 160x120.

This script loads my php random image, which returns a random jpg file name to flash

[AS]#include “NetServices.as”
#include “NetDebug.as”
directory = “pics”
getImage_Result = function(image){
message.text = image
key1.loadMovie(“services/”+directory+"/"+image)
}
var conn = NetServices.createGatewayConnection(“gateway.php”);
var myService = conn.getService(“randomImage”, this);
myService.getImage(directory)
function refresh(){
myService.getImage(directory)
}

function preload() {
var temp = this.createEmptyMovieClip(“tmp”, 9999);
temp.onEnterFrame = function() {
var ct = key1.getBytesTotal();
var cl = key1.getBytesLoaded();
if (cl == ct && key1._width>0 && key1._height>0) {
var w = key1._width;
resizePic(w);
delete this.onEnterFrame;
}
};
}
function resizePic(w) {
if (w != 160) {
key1._width = 160;
key1._height = 120;
}
}
stop()
[/AS]

This has incorporated one of Scotty’s Scripts, but i just can’t seem to get any of them to work…I’m thinking becasue its the PHP

I’ve even put this into MC - Key1
[AS]onClipEvent (data){
key1._width = 160
key1._height = 120
}[/AS]

So does anyone have any idea on how to resize a PHP loaded jpg into a movie clip to be automatically resized 160x120 (distorted proportions aren’t a concern)?

Thanks in advance. Sorry if this has been covered before but I couldn’t find anything like it after trying related scripts for a few hours :kir: