This is a question I've been trying to work through but can't understand. What currently prevents an imagefield item from being able to be shown within a body field? is it that it is considered inappropriate to have a field within a field as it relates to a node. I've just been thinking about the concept of "all is fields" which appears to be the future of drupal. Obviously an image within a body field, or similar text field has a certain direct relationship to that text, whereas an imagefield in a node would have more of a relationship to the title of that node.

Is it a UI issue that is preventing this from happening (field within a field) or is it a philosophical issue, and if so, could you shed some light on it.

I'm quite sold on the imagefield solution, but this lingering bit is gnawing at my brain.

Comments

quicksketch’s picture

What currently prevents an imagefield item from being able to be shown within a body field?

There is no limitation preventing the use of other fields within the body. The problem is that there isn't any particular place within the body where the image would be inserted, you have to tell Drupal somehow where that image should be placed. I think the most likely way to solve this problem is to use the filtering system to place the field within the body, with a token of some sort such as [field_image:0], which would refer to the first image within the field "field_image". Inline module seems most likely to support this in the future, however it is not yet implemented. See #147979: CCK Imagefield support

Trunkhorn’s picture

So you see this working like how the path filter module works for internal links. What do you personally use for inline now though, especially at the user level?

quicksketch’s picture

Title: Field within a field » Display Image Field Inline

I personally have been using a custom module for this (I know, I know...), which probably isn't a lot of help. I'm working on converting it to a contributed module but it's probably a few weeks out. I've been polling around #drupal in IRC and looking for existing projects, but it doesn't look like this has been done before (which is rather shocking, considering the 3000+ modules out there). It'll probably eventually be included in the FileField project directly, as a separate module which can be enabled.

Anyway, here's the idea:

skitched-20090421-023308.png
Uploaded with plasq's Skitch!
skitched-20090421-024348.png
Uploaded with plasq's Skitch!

However I'm not really sure what most people are doing in the mean time. Seems that a lot of people don't use a FileField at all and just upload directly through IMCE. I personally think this has all kinds of usability and long-term problems, so I'd like to see a better solution for people wanting an easy way to insert images and files without having to muck with a file browser.

Trunkhorn’s picture

I definitely like that your mockup is based on standards for long-term viability, and like you said not having to muck with a filebrowser is a plus.

I'm also somewhat astounded something doesn't exist for this already, which is why I wanted to ask you directly and get your take on it.

I'm really a long-term standards type of person which is why I'm kind of sitting on my hands waiting for something to pop up. I personally also can't see the IMCE thing being sustainable for me at all, especially since I like using imagecache actions for watermarks and such. I'm just allowing one image per node through imagefield at this point just to play it conservatively.

Anyways, thanks for sharing your experience. I'll be watching inline module, and keeping an eye out for what you're doing in the next couple of months.

Trunkhorn’s picture

It just dawned on me that if the images were added as files in a filefield with that direct img link in the mockup, then it wouldn't be available for processing by imagecache. Does that sound right?

quicksketch’s picture

Files are always available for processing by ImageCache as long as they're in the files directory. Of course if you insert an image inline, then you can no longer move it around on the page (other than CSS) or affect it in other ways without some regular expressions to find the img tag and modify it. As shown in the second image, I plan on making an ImageCache select list so the user can choose which size they'd like to display, but again, once it's displayed inline it'll be hard to change which preset they've used. If you'd like the ability to completely control the output, you'd need to use the approach of inline.module and put in a placeholder like [imagefield:example.png], which of course wouldn't work too well with WYSIWYGs.

Finally, as a completely different approach (probably the most common one), if you want complete control of the positioning of the image, just don't let the user place the image at all. Theme the output of your node.tpl.php file to place the image exactly where you want it, and affect all the content on the site in the same way.

quicksketch’s picture

Status: Active » Fixed

Moving to fixed as a support request.

The module I described above has been released (very early alpha, no support): http://drupal.org/project/filefield_insert

Trunkhorn’s picture

Thanks for this!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.