So you upload an image or three to your node, and you're wondering: "how do I get them in there?" ;) Well here's how I got them in there.
To follow this tutorial, you will need:
- To feel comfy writing your own HTML for images, e.g. <img /> tags
- To have installed CCK, ImageField and ImageCache.
- To be familiar with how an ImageCache preset affects the upload process of an image when you use an image field to upload it.
You will also need the following information:
- The name of your uploaded image file
- The name of your image preset (the "image preset namespace"). Navigate to your ImageCache settings and hit "edit" for the preset in question - you should be able to see the preset name space.
- The name of the folder where your image field will store its images. To find this, go to content management and get to the configuration page for your image field. You want to know the "File path" under "Path settings".
Warning: If you are using tokens to determine this, you will also have to figure out exactly what the path will be for your uploaded image.
So, assuming you have a piece of content, and are at the content editing page, this is how you get your ImageField images inline.
1. Upload your image
Remember the image name!
2. Write the <img /> tag
In the body of your node, write an image tag to point to your uploaded image. For the source attribute, use the following pattern:
src="sites/all/ [ "files" directory ] / imagecache / [imagecache_preset_name] / [image_field_name] / [image_file_name]"
- My default files directory was "files",
- My ImageCache preset file path was "my_teaser"
- My ImageField File Path is "article_images".
- And my uploaded file's name was "this_was_easy.png"
Then my <img /> tag would look like this:
3. Ker-POW! Done.
If you want to style your images, just add some class names or direct style elements. I have basic .float-left and .float-right styles defined in my style.css, and I just add the appropriate class to float the inline element in whatever paragraph I put it.
- "sites/all" is just where my installation finds its websites. If you're using "sites/default" or some other path, you have to take that into account.
- I don't know enough about ImageCache to know whether it can be configured so that presets save to different file paths.
- I have never actually tried this with tokens - if you have tokens running, and this isn't working, please post a comment to save people hours of frustration
I hope this helps, and doesn't confuse anyone.