Hi,
I thought it would be good to be able to easily reference attached images from within the node's body. This would allow an author to be able to place the images where they want (making it easier for the text to refer to the image), without needing to know the physical location of the files (or even what the filenames are), and still have the images part of the node.
So I created a patch (attached) and it seems to work well.
The patch works by looking for [IMAGE] tags in the body (and teaser) of a node and replacing them <img> tags. The format of which is:
[IMAGE:<"pic"|"thumb">:ww[:<align>]]
Where:
- pic - the actual picture
- thumb - the thumbnail of the picture, with a link to the actual picture
- ww - the weight of the picture (this is how you select the correct image)
- align - the images alignment on the page, and is an optional modifier
Examples:
- [IMAGE:pic:2] - This would place the image that has a weight of 2 in the body.
- [IMAGE:thumb:-5:right] - The would place the image that has a weight of -5 in the body and make it right aligned.
If there are several images of the same weight then only one would be used (depends on the order they come out of the database in).
| Comment | File | Size | Author |
|---|---|---|---|
| node_images.image.patch.txt | 3.09 KB | kmv |
Comments
Comment #1
stefano73 commentedHello Keith,
thanks for trying this module and sending the patch. I think that adding inline images (and files in general) should be discussed as a topic for a core module, and not split into several contribution modules. Your example has 2 problems, in my opinion:
1) the IMAGE tag might be used by other contributed modules in the future, and this would make a big confusion;
2) chosing of the weight as image identifier is not correct, because if some images share the same weight you would never know which one you will see in the node body.