Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am doing a small project and I want to display images from a zipped folder automatically without actually linking each images. In this case,I would also change other zip folder.The system should be able to access images from that new folder. So how do I do this?
Posted
Comments
ZurdoDev 19-Jan-15 14:39pm    
Where are you stuck?
Sergey Alexandrovich Kryukov 19-Jan-15 15:03pm    
Why zipping them?
What is your server-size technology?
—SA

1 solution

First of all, zipping of images makes little sense. Lossy image compression algorithms, such as JPEG, are much more efficient on images than ZIP.

Unzip it before showing. The way to do it one the fly depends on the server-side technology you use. One common part is: your script representing the resource should write an HTTP header with correct content-type. For example:
HTML
Content-Type: image/jpeg

Please see:
http://en.wikipedia.org/wiki/List_of_HTTP_header_fields[^],
http://en.wikipedia.org/wiki/Internet_media_type[^].

Basically, you get request for the image (say, quite simply, image name could be a URL parameter you can extract from URL). Your code takes the ZIP file, extracts the file content into the stream (no need to create a file on disk), then writes the HTTP header "Content-Type" followed by the content of this stream.

If you don't use any server-side, unzip the files and store then unzipped on your server.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900