This was a hack I did on the admin content component in Joomla 1.0.8 – ish about 3 years ago. Worked well at the time and I thought I’d share it here regardless. Not that I advocate hacking up the Joomla core so to speak but when you can prove to be creative, it often pays off. Here’s the original post:
So who wants to put up with the pain of file naming conventions just to make images show up in specified positions on the template. Not me. So what I did was modify the MOSIMage controls under the Images tab in the content administration.
I noticed that all of those somewhat useless attribute modifiers at the bottom of the Images tab actually just appended values onto the end of the image path string in the database delimited by “|” ‘s. COOL. So I thought I’d try and make my own attribute modifier called ‘Image Position’ so that I could assign images their positions no matter what the image file name was. This proved to be pretty simple.
I opened ‘/administrator/components/com_content/admin.content.html.php’ and took out all the other modifiers in the table html. Then I plugged in my own select box with pre-defined image positions that could be applied (appended to the end of the image path string in the db) to the image. When selecting an image from the ‘Content Images’ select list. a javascript function is called named ‘showImageProps’ and is in the file ‘/includes/js/joomla.javascript.js’. This function simply does it’s own parsing of the image data and populates the MOSImage Control attributes. In this case. I had to make a very quick and easy modification to this function to have it populate my new ‘Image Position’ field.
Then on the front end of things. I simple made an included file that first parses each image in the ‘images’ column of the content which is delimited by “\n” ‘s. Then one by one. I parsed out the attributes (in this case now there is only one and that is the image position). did a quick lookup in a switch statement to match the position’s name which in turn wrote out the image tag.