Shrine 3.x: Overwrite original version possible as 2.x?

Hello,

In Shrine 2.x, I replace the “original” file version with my resized version, to save data space on S3, and because the original version was not useful, using the versions plugin:

versions = { } # { original: io } don’t retain original => versions should be empty
versions[:original] = pipeline.quality(90).resize_to_fit!(640, 960)

Is-it possible in Shrine 3.x, as the original file should not be included in the derivatives ?

Attacher.derivatives_processor do |original|
magick = ImageProcessing::MiniMagick.source(original)

# the :original file should NOT be included anymore 
{ 
  
  large: magick.quality(85).resize_to_fit!(400, 600),
  small: magick.quality(80).resize_to_fit!(320, 480),
  tiny: magick.quality(75).resize_to_fit!(160, 240),  
}

end

I’m not sure it’s now possible to overwrite it.

Thanks,

One of the goals of the derivatives plugin was separation of original and versions, so the derivatives plugin doesn’t provide original rewriting functionality.

Furthermore, even though Shrine originally allowed easy rewriting of the original, over time I started recommending against it, and therefore didn’t replace this functionality after deprecating the processing plugin. The reason is that without the original file you cannot properly reprocess versions if you find a bug in your processing code, so using that extra storage space is IMO a good trade-off, if in return we get to “retain all information”.

That said, this discussion contains some tips for overwriting the original.

Hi Janko,

I will follow your advice, and keep the original, (even if it will increase GB on S3 :wink:

Thanks,
Alexandre