radiospiel / imgio

An image asset resizer along the lines of sencha.io
25 stars 1 forks source link

Ideas for more universal workflows? #8

Closed radiospiel closed 12 years ago

radiospiel commented 12 years ago

I would like to see something which allows the user to construct workflows, and which allows the application to define possible workflow steps in an easy to use syntax.

A workflow could be something like:

which, as an URL, could probably look like this:

http://<server>/jpg/70/fit/100x200/mask/frame/12/http://<src-url>

Any thoughts on this?

Overbryd commented 12 years ago

Hy,

I think that the experience consuming a GET based API is cool for simple sharing and opening a link. But if there is need for workflows, I think a POST API with JSON formatted instruction would fit better. My primary reason is simply because I imagine a better user experience. I think putting together a long string for a GET request is harder than having a nice JS that allows structured options and talks to the POST endpoint.

That would mean a little bit more work on the imgio side, including a jQuery lib, but the overall experience would benefit from that extra work.

Markup-wise:

<img data-src="http://lolcats.org/big-cutie.tiff" data-imgio="fit-50x50 rotate-90" />
radiospiel commented 12 years ago

With respect to how hard it is to write a workflow definition you are probably right.

The bad thing with POSTing is mainly that then request caching would stop working, and caching stuff is one of the main things why I like to do this. As the result of a workflow probably never changes this would put unnecessary load onto the server.

However, a JS library could still take care of that, and format the URL strings accordingly. URLs - and workflow definitions - would still be limited in length, though. AFAIK there is no minimal maximum URL length defined anywhere, but most browsers do support 1 or 4k characters or so.

What we could do, of course, is to POST a workflow definition, which then returns a workflow-id, and then use that id to run the workflow. But this sounds awfully like what transloadit is doing already?

radiospiel commented 12 years ago

Another thing regarding the markup as you suggested: one could even do CSS based on that, which sounds awesome; like

img[data-imgio*="50x50"] {
  width: 50px;
  height: 50px;
}

This is definitely good stuff.

radiospiel commented 12 years ago

Just back from implementing a GET-based universal workflow, will push in a minute. A POST-based workflow definition and a potential jQuery plugin to help with creating proper URLs is probably something belonging to #6