I think it's not effective way if we create an array of all the images and then echo out the array.
Maybe you can use below algoritma (below are not working codes) :
$Page = $_GET['page'];
$ImagesPerPage = 10; //number of images per page
$StartImage = $Page * $ImagesPerPage;
$q = "SELECT * FROM table_images ORDER BY id ASC LIMIT $StartImage, $ImagesPerPage";
/*
Show your Images here
*/
//Paging here:
echo "<a href='$PHP_SELF?page=". ($page - 1) ."'>previous</a>";
echo "<a href='$PHP_SELF?page=". ($page + 1) ."'>next</a>";