image - PHP - Link img element to PHP file -


i'm trying link img element php file.

image.php handles img element. code.

header('content-type: image/jpeg');  $imgs = array(      'media/documents/penguins.jpg',     'media/documents/chrysanthemum.jpg',     );  $createimgs = array();  foreach ($imgs $img) {     $createimgs[] = imagecreatefromjpeg($img); }  foreach ($createimgs $createimg) {     imagejpeg($createimg); } 

and content of index.php

<h1>title</h1> <img src="image.php?img=1" alt="" title="picture 1" class="pic"> <img src="image.php?img=2" alt="" title="picture 2" class="pic"> 

it works display of both penguins.jpg, chrysanthemum.jpg not displayed.

how can display penguins.jpg , chrysanthemum.jpg in order?

any idea of help!