script for connect images into blocks