Skip to content
Advertisement

Tips for client server communication for website with loads of images

I want to build comic book reading website that it has thousands of images on the server. Each series has hundreds of chapters and each chapter has tens of images. So I want to display these images on my website. How can we do this with less effort?

I am using AngularJS for the frontend, and for the API its Slim Framework.

I read that storing the img paths on the database is better solution. So its good to query all the image paths to MYSQL? Like http://mywebsite.com/mangas/naruto/23/001.jpg. Or use some sort of regular expression. But every image has different extensions. Some of it .png, some of it.jpg and some of it 3 digits naming, some of it 2 digits naming.

-And what about when I upload a new chapter. Do I have to query all the images again?

-So is there a solution for me like this: I upload chapter wtih SFTP and then automatically my website updates itself and the chapter I uploaded appear on my website. Is somemthing like this achievable?

Advertisement

Answer

So many many ways to do this.

How about putting all the images for one chapter, in a CSV file stored on your server; so, one file for each chapter… then, request a chapter.

Slim gets the httpRequest and fires a quick php read of the file; put each line into an array, inside a for loop. Then, to make it easier on the client side, the array before Slim returns the data.

Then on client, each element of the array will be the name of one of the images for the chapter the user is viewing/reading; feed the image names into your Angular…

Just take a deep breath and build something, then figure out how to make it better.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement