# Resize dynamic jpg from xml, in max size

**URL:** <https://forum.kirupa.com/t/resize-dynamic-jpg-from-xml-in-max-size/226874>\
**Category:** flash\
**Created:** [May 24, 2007, 7:24pm UTC](https://forum.kirupa.com/t/resize-dynamic-jpg-from-xml-in-max-size/226874 "2007-05-24T19:24:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![satiss](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@satiss](https://forum.kirupa.com/u/satiss)\
**Post date:** [May 24, 2007, 7:24pm UTC](https://forum.kirupa.com/t/resize-dynamic-jpg-from-xml-in-max-size/226874/1 "2007-05-24T19:24:16Z")

</div>

What I want to do is load external jpgs and display them within a predifined box. I use the Kirupa’s code for the image loading part ( [http://www.kirupa.com/developer/mx2004/xml\_flash\_photogallery.htm](http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm) )

But the original images are larger than the display box. I want to rescale them with actionscript, and keep the size ratio of it. But the original pictures don’t have the same size.

Does someone has a mathematical equation (or a link) to solve this problem? 😟

Thanks
