1 of 10

Imager 2.0

...or whatever it’s going to be called.

2 of 10

Originally Made To...

  • Attach images to any model�
  • Preprocess images�
  • Handle storage specifics

3 of 10

Unfortunately...

  • Tracked and associated all derivative images
  • Hard-coded image processing pipeline
  • Hard-coded storage & inflexible URI generation
  • Used a 3rd party library that lacked features of others
  • Required a hack to bust caches
  • Didn’t retain original images
  • Limited configuration power
  • Cracks starting to show with the addition of slots
  • Could be ever so slightly nicer to use

4 of 10

Imageable

  • Start out with the original trait
  • Traits are inscrutable, so define an interface
  • Implement the interface as a trait

Taking this approach gives you type-safety with traits. New convenience methods will be added over time.

Ideas?

5 of 10

Taking the “rage” out of Storage

  • Knows how to generate URIs
  • Responsible for getting the original
  • Uses filters to key variations

�Template developers, don’t worry!

Because...

6 of 10

The Service

  • Selection of images is done via Eloquent relation
  • Image class has many neat scopes with more to come
  • Calls are passed into the currently active driver
  • Only scratching the surface of what’s in the service

...is your primary interface - not the driver!

( Of course, this can be shortened even further by the use of variables, loops, etc… )

7 of 10

Filters

...are super sweet

Obama says thank you!

Obama says thank you!

8 of 10

Slots

  • Introduced later in Imager to allow for sorting
  • Unique by Imageable
  • Not just limited to integers
  • Full compliment of service methods to perform safe manipulations

Item #101

Image #34

1

Image #72

2

Image #5

3

Image #3

thumbnail

Item #202

Image #13

1

Image #90

2

Image #19

3

Image #24

thumbnail

Item #303

Image #18

1

Image #65

2

Image #11

3

Image #83

thumbnail

9 of 10

Batching

  • Standard mechanism to perform bulk operations
  • Scoped to Imageable, performed by slot
  • All operations are done in a safe order
  • Caller agnostic, fit for any circumstance

10 of 10

Thanks!

  • Anywhere you see “Imageable”, omitting it or supplying null is valid and means “global”.�
  • Passing an empty array, null or omitting for a “filters” parameter means “the original image”.

  • Thoughts?
  • Releasing to github, name suggestions?