Dynamic image resizer with some bugs fixed