Yeah, I wouldn't use this procedure for an image gallery. I've used it to store images for buttons in certain javascript applications (like InDesign Extendscript or Firefox Custom Buttons) where you don't want external files, and I use it myself for images in email signatures. The value of this is that you can store the image inside the code - so it would be best for smallish type icons.
However, to avoid 117-line strings, you could always disable wordwrap in your text editor! hahahaaa