Image Flow: Let images float through your post!

"Scratch your own itch" is one of the mottos of the open-source movement. And this evening, I had one monstrous itch.

If you saw this blog more than a week ago, you'll remember that I only recently cleaned it up from a horrible mess and upgraded it to Drupal 6 at the same time. Since then, I've found numerous small ways to improve it. For the most part I use widely available addons (archive, tagadelic, adsense, agregado), but I freely hack away at them when I need more functionality.

For example, you may notice that when you are on an older post from October 2007, the calendar block to the right will show October 2007 instead of November 2008 - it doesn't do that out of the box. The tag cloud shows tags from both vocabularies, both the freely tagged "keywords" and the strictly hierarchical "news category", which required some extra code as well.

{{image_flow.png|right|200px}}But to get back to the itch above, I was really annoyed with the poor image attachment support. I can attach image files to every post, but they will be displayed below the text - to add them in the text itself, I have to enter specific HTML after I've uploaded the images, and this HTML will break if the site ever moves anywhere else, since it references internal paths.

~ ~ ~

What I started out with was a contemplate template that was intended to replace internal placeholders like the below (wiki-like syntax) with appropriate HTML to add the image in a floating box.

{{image.jpg|right|100px}}

Then I realized that I wanted to generate thumbnails server-side, and the template very soon spilled over into its own module. And so I can now, after an evening of coding, present Image Flow.

{{druplicon.small_.png|left|100px|noresize}}Image Flow hooks in at the "alter" (final) stage of hook_nodeapi. It checks your node for the content of CCK imagefield fields, then scans for placeholders like the above to replace them. Images get automatically scaled to the proper dimensions, and added as a floating box on the proper side within the text.

Then - and this is what I'm most proud of - the full-size image can be viewed in a box that fades in when you click on the thumbnail, Lightbox-like.

Image Flow is barely ready for testing, let alone release, but a version for Drupal 6 has been attached to this post. You can also check it out from my SVN repository:

svn co http://svn.ermarian.net/drupal/modules/image_flow

If you do not want an image to be enlargeable (for example, a software logo that offers no additional information in full size), the extra option "noresize" will cause the thumbnail to be shown without any full-size link.


{{logo.jpg|left|100px|noresize}}

yeah!

I've been contemplating something like this for a while now myself. What would be really great is if you could hook this into an existing wysiwyg editor so that it's useful to clients and not just us tech heads. I'll be downloading this to play with it tomorrow. Smile Nice!

also...

your revisions are showing. dunno if that's intentional.

nice

will check this out, i was working on a site yesterday that could use this.

Inline / Image Assist / Wysiwyg

This is exactly, where my current efforts of rewriting a bunch of modules are heading to:

Inline as generic macro processing engine, which will be 2.x. 1.x already exists for years and achieves most of what you're doing here, including ImageCache and Lightbox support. However, when 2.x is ready, it will provide the engine for other modules only.

Image Assist does more than you want here (images as nodes), but already uses a macro syntax that Inline will use in the future (for several reasons). It is the glue module that allows the user to browse and select (and upload) images to insert and edit, also providing all macro parameters as configurable form elements in a dialog. When Inline API is ready, it will defer the macro processing work to Inline. While Image Assist only supports Image module images currently, it is basically able to support ImageFields and other media, too.

Lastly, Wysiwyg API will allow to integrate Image Assist's (and other modules') buttons into any client-side editor (textarea, TinyMCE, FCKeditor, htmlbox, you name it), while ensuring that novice users do not have to think about and see macros by allowing Drupal editor plugins to present embedded previews instead of macros.

See:
http://drupal.org/project/inline
http://drupal.org/project/img_assist
http://drupal.org/project/wysiwyg

Cheerio,
Daniel

PS: Nice design! Smile

Wysywyg

Sorry, I make it a point to avoid that stuff completely - I'm using BBCodes for everything instead. I could try to contribute to Wysywyg without using it, but since it is a usability module, I'd be bound to get something wrong.

Looks Promising

I'll be sure to check out your module. There's undoubtedly a need for a robust, easy to use solution for embedding images.

Just a note, it seems that all image URL's in this post are relative, even in the RSS feed.
So when viewing this post on http://drupal.org/planet all the image links appear broken.
I'm not sure precisely if the RSS specification requires absolute URL's. If so, then hopefully it would be easy to do this. Otherwise, perhaps there's a problem with Drupal planet.

Join forces - decrease confusion.

If you do not like client-side editors and have no need for Wysiwyg, that's fine.

All I'm asking you is to not release this module on drupal.org, since that would increase the confusion even further. We have Inline, Image Assist, IMCE, and Asset already. Even worse, a bunch of half-baked projects/modules have been published, which could have been turned into simple patches for one or more of the existing modules. For novice Drupal users, it has always been a pain to choose from one of the mature modules - with all those "simple", "yet another helper" modules that work only under certain circumstances and site setups, the evaluation and decision process has become a pain in the a**. Sorry, there are no other words to describe the current situation.

No worries

The market for Text-beautifier modules on d.o. is extremely tight already, so I wouldn't dream of adding to it. The module does work very well on my site, however, so I have placed it here in case anyone wants to build on it for their own purpose. This thing won't be supported in any shape.

Just wanted to draw your

Just wanted to draw your attention to this other module which sounds pretty similar: http://drupal.org/project/easy_image_insert

Interesting

Even though there are various modules around that do similar things, Image Flow sounds far more interesting. Actually it is exactly what me and my company have been waiting for. How ambitious is the development? Can we count on this to develop?

Non-maintained

Sorry, while I may work on this module a bit further, I can't guarantee future maintainance and support, because as an unofficial contrib module, nobody else on Drupal.org can take it over from me.

However, you are welcome to take the code that exists so far and adapt it for your needs; I have attempted to make it as clean and Drupal-style-compliant as possible. If you need a professional developer to work on it, you can also try the paid services forum on drupal.org.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may use these tags: [abbr], [acronym], [b], [center], [code], [color], [cpp], [css], [define], [diff], [dtd], [font], [h3], [h4], [h5], [h6], [hr], [html], [i], [image], [img], [java], [javascript], [justify], [left], [list], [mysql], [node], [ol], [perl], [php], [python], [quote], [right], [s], [sh], [size], [sql], [sub], [sup], [table], [u], [ul], [url], [wikipedia], [xml]
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Easily link to terms in various wikis. For help, see <a href="/interwiki/3">interwiki</a>.
  • Textual smileys will be replaced with graphical ones.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Syndicate content