Well, you'd have to have an image processing script (like image.php) and call that with a $_GET variable for a specific image, which is used as the "src" attribute of the <img> tag.
<img src="/path/to/my/image.php?img=1024" />
Then in your image.php page, you have to determine which image is requested (via $_GET['img']) and resize and output properly.
Alternatively, you could use a second parameter in imagejpeg() to save the resized image somewhere and use that literal image instead of a dynamic one like explained above.