onun yerine soyle baslasak, bosuna db'den veri cekerek cpu yormaya gerek yok sanirim

image.php
<?php
$id = intval($_GET['id']);
header('Content-Type: image/jpeg');


// bu resim gostermeyi yapamadim

"http://www.site.com/resimler/".$id.".jpg"


?>