# Resizing PHP-Loaded Image in a MC

**URL:** https://forum.kirupa.com/t/resizing-php-loaded-image-in-a-mc/124663
**Category:** Uncategorized
**Created:** [October 5, 2004, 7:44pm UTC](https://forum.kirupa.com/t/resizing-php-loaded-image-in-a-mc/124663 "2004-10-05T19:44:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ak\_denver](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@ak\_denver](https://forum.kirupa.com/u/ak_denver)
#### Post date: [October 5, 2004, 7:44pm UTC](https://forum.kirupa.com/t/resizing-php-loaded-image-in-a-mc/124663/1 "2004-10-05T19:44:54Z")

</div>

I have loaded an image dynamically from PHP into a MC. The movie clip is 80X60 but the jpegs are all different sizes (but in the same proportions). I know that the MC takes the size of the image when it is loaded, but how do I constrain or lock the dimensions of the MC and the jpeg at 80x60? It works if I use \_yscale and \_xscale but I want the exact dimensions 80X60. Shouldn’t \_height and \_width work?

Here is the code I’m working with now:

myData = new LoadVars();  
myData.load(“data.php”);  
myData.onLoad = function(success)  
{  
if(success)  
{  
trace(“holler”);  
setpic(this.picFile)  
}  
}

function setpic(pic)  
{  
trace(“setpic”);  
pics.loadMovie(pic);

maxwidth = 80;  
maxheight = 60;

if (pics.\_width \> maxwidth) {  
delete \_root.onEnterFrame;  
\_root.pics.\_width = maxwidth;  
// Adjust height to new scale  
\_root.pics.\_yscale = \_root.pics.\_xscale;  
}  
// Now check if image is too tall  
if (pics.\_height \> maxheight) {  
delete \_root.onEnterFrame;  
\_root.pics.\_height = maxheight;  
// Adjust width to new scale  
\_root.pics.\_xscale = \_root.pics.\_yscale;  
}  
}
