There is a list of pictures, example:

  • http://userserve-ak.last.fm/serve/_/8916787/Elffor.jpg
  • http://userserve-ak.last.fm/serve/_/18417003/Die+Verbannten+Kinder+Evas+die_verbannten_kinder_evas.jpg
  • http://userserve-ak.last.fm/serve/500/43976381/Falkenbach.png
  • http://userserve-ak.last.fm/serve/_/72464110/Avathar+33707_photo.jpg

How can I make an archive with these pictures offered to the user for saving?

  • merge them into one folder for archiving and send the header. - Artem
  • And if you do not pictures, but for example something heavier? each time to merge and save on the server? - Tchort
  • it is not necessary to save, but then you need to constantly generate this archive, and it is expensive for the server, so it’s better to archive once and return until the pictures are updated :) - Artem
  • and how exactly generates archives?) - Tchort
  • You can search for php and create archives. - Artem

1 answer 1

First, copy the file to the archive folder.

 $from = 'http://somewhere.from'; $to = 'to'; if (!copy($from, $to)) { echo "failed to copy $from\n"; } 

Then we archive

 $zip = new ZipArchive; if ($zip->open('something.zip') === TRUE) { $zip->addFile('to', 'to.zip'); $zip->close(); } else { echo 'failed to archive $to'; }