I wanted to be organized so I created a Content Type called image_in_article that consists of a Title and an Image.

I want to use this in articles and basic pages as such

This is my text here. This is my text here.

Here's the pretty picture we took:
<img src="***URL link to image uploaded as image_in_article">***Title of image_in_article***</a>

More text here. More text here.

But I'm not really sure what I put in the starred areas to accomplish what I want.

It would be even better if I could have Drupal create a token that contains the entire <img src= ...> string and just insert that into the article.

The ultimate would be if my content editors could pick the image from a list and plop the image in the middle of the article.

Can this be done in Drupal? How? When I try using tokens in body text it just prints the token without "detokenizing" it. Thanks.


cfox612’s picture

First off you can add fields to the other content types, which would probably easier. I'm not sure how you were planning on paring the "image_in_article" with the actual article.

Second if you want the image to appear in the middle of the body text, it would have to be added there with a WYSIWYG module, not an image field (unless it's always going to appear after the 3rd paragraph or something, in which you can create a custom template file and use some PHP to render it accordingly). Otherwise you'd probably want it just floating to the left or right, which you can easily accomplish with some CSS.

jsruzicka’s picture

I wasn't sure how to do the pairing, either, or if it was possible. The reason I want a separate image type is that the same images will be used in multiple places and it seems more efficient to point to one copy than to upload the same image multiple times, especially if the image has to change later.

VM’s picture

same image used multiple times see the filefield sources.module.

VM’s picture

https://drupal.org/project/insert will aid. It will allow the use of an image field, integrates with a wysiwyg eidtor (if you so choose) and allows immediate placement in the body field where your text will be placed. The benefits of using an image field are that you can pull the images with the views.module if you wanted a gallery type effect later.

jsruzicka’s picture

Thanks, again as my teacher said "there's a module for that". :)