sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Klco <daniel.k...@gmail.com>
Subject Re: [proposal][contrib] File Optimization
Date Thu, 31 May 2018 16:13:05 GMT
Yeah I had a similar thought so I added a revert option. The original
binary content is saved in a separate attribute optim:original and I added
in a Sling Post Operation to restore this content.

A selector option certainly makes sense. I'll refactor this a bit to
support the optimize-only option better.

Regards,
Dan

On Thu, May 31, 2018 at 11:16 AM, Jason E Bailey <jeb@apache.org> wrote:

> So the point of conversation that I see is that this is a modification
> that occurs on POST.
> I'm a little bit uncomfortable with pushing content and having that
> content modified without anyway for me to revert it.
>
> I would think that a selector would have been more appropriate.
>
> Or, and I'm stretching here, I wish we could stop saving images with
> extensions in the file name and handle them as data assets and have an
> image handler that would deal with the appropriate extension. Like 'jpg" as
> an example.
>
> On the whole I think this is a good idea.
>
> - Jason
>
> On Thu, May 31, 2018, at 9:12 AM, Daniel Klco wrote:
> > Hello Sling Devs,
> >
> > I pushed in a library prototype for automatically optimizing files (for
> the
> > moment mostly images) in the Sling whiteboard repository[1]. The need
> > solving here is if you are creating a website with a Sling-based
> > application you want to save bandwidth by optimizing all of the images on
> > the site, but optimizing images requires another 3rd party tool such as
> > ImageOptim, PngCrush, ImageMagic, etc. Instead, it'd be great if you
> could
> > just optimize the images (and other files as well) right in the CMS.
> >
> > With the FileOptimizer, you could create something like what I created
> for
> > Sling CMS:
> >
> > Before Optimization Screenshot - https://imgur.com/PjLVmzv
> > After Optimization Screenshot - https://imgur.com/Ut43PxZ
> >
> > The FileOptimizer Library uses the whiteboard pattern to allow developers
> > to register FileOptimizer instances. Each FileOptimizer will optimizes
> one
> > or more file types by getting a stream of data and optimizing that data.
> > The library handles:
> >
> >    - Ensuring the file has not already been optimized
> >    - Finding the right FileOptimizer for the file type
> >    - Making sure that the optimization actually resulted in a smaller
> file
> >    - Storing the results of the optimization
> >
> > The library also includes:
> >
> >    - A Sling Model for previewing an optimization
> >    - A Sling Model for seeing the data from an optimized file
> >    - Two Sling Post Servlet Operations, one to optimize the file, one to
> >    revert to the original
> >    - Servlets for getting a preview / data for an optimization
> >    - An OSGi Event handler (disabled by default) to automatically
> optimize
> >    files
> >    - A FileOptimizer for PNG files using
> >    https://github.com/depsypher/pngtastic
> >    - A FileOptimizer for JPEG files using a configurable compression
> level
> >
> > I'm very interested in your opinions about this module and if there are
> any
> > suggestions / recommendations.
> >
> > A few specific points:
> >
> >    - Right now the library uses a separate namespace (optim) for all of
> >    it's properties and mixins, does that seem acceptable or should these
> be
> >    moved into the sling namespace?
> >    - The servlets are registered under /system/fileoptim, is there a
> better
> >    path?
> >    - Any suggestions / improvements for performance / features
> >
> > Regards,
> > Dan
> >
> > [1] - https://github.com/apache/sling-whiteboard/tree/master/file-optim
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message