/// <summary> /// Called from ZipFile.Save as each queued entry is processed. /// </summary> /// <param name="entryName"></param> /// <param name="stream"></param> protected void WriteItemCallback(string entryName, System.IO.Stream stream) { BatchResizeItem i = items[entryName]; if (wouldResize(i)) { //Buffer in a memory stream to avoid stepping on CrcCalculatorStream's broken toes using (MemoryStream ms = new MemoryStream()) { s.conf.CurrentImageBuilder.Build(i.PhysicalPath, ms, new ResizeSettings(i.ResizeQuerystring)); ms.Position = 0; StreamUtils.CopyTo(ms, stream); } return; //We're done! } //For non-resizeable items, Just copy the stream. using (System.IO.FileStream s = System.IO.File.OpenRead(i.PhysicalPath)) CopyStreamTo(s, stream); }