« Mobile Blogging | Main | Translucent Title Panels »

Sunday, October 18, 2009

Image Handling Strangeness

I just encountered another strangeness with image handling in Thingamablog. Everything worked out OK, but one of my images has been duplicated and renamed.

I imported an image named, "devil-2797.jpg" into the media folder. In the entry editor, I posted the image using the image wizard and then pointed to the image in the media folder in the database folder. The end result was the HTML entry pointing to an image named "devil-2798.jpg", which now also exists in the media folder on my disk. I don't know where the second image came from, if I imported it twice or if it was duplicated upon publishing. I did this in my other blog, "Nothing Happens At Ten".

To puzzle this out, in this entry I have gone through the exercise again to see what happened. I have imported the following image into my media folder to see what happens when I publish:

Body background  

The name of the file is "nhat-bodybg.jpg", and it resides directly in the database media folder.

The URL that is in the current HTML after the import (but before I published the entry) is:

  
  <img align="middle" width="300" 
  src="file:/home/brian/blogsdatabase/1247882990333/web/media/nhat-bodybg-1.jpg" 
  alt="Body background" border="1" height="265">

It is pointing directly at a file on my hard disk, but the name of the file has been changed to append the "-1" on the end. I have apparently imported the image again, and Thingamablog has avoided overwriting the original file by assigning it a new name. I now have two copies of the file in the media folder with different names. The second one is used in the HTML.

To continue this test, I have posted another image, named "nhat-titlebg.jpg" by referring directly to the image stored somewhere other than in my database directory. Here is the image:

Title Background

After including the image in the entry, but before publishing the entry, here is the URL in the HTML editor:

  
  <img align="middle" width="300" 
  src="file:/home/brian/blogsdatabase/1247882990333/web/media/nhat-titlebg.jpg" 
  alt="Title Background" height="265">

This URL is also pointing to the media folder in the database folder. Digging down further into the guts of this thing I notice that the new image has already been copied into the media directory on the disk, but it does not appear in the "media" listing through Thingamablog yet. I suppose that the database which maintains the listing of imported files will be updated when the entry is published. We shall see. There is only one copy of the image in the media folder.

There is an apparent implied import of the image into the media folder simply by including the image in an entry, regardless of where the original copy of the image resides on the disk. The image is copied into the folder, but not logged in the database yet.

To continue reverse engineering the tool, I removed the image above.

The copy of the image in the media folder was not deleted. It is still invisible to the Thingamabog GUI, but the file still physically exists on my disk in the media folder.

I put the image back, and it made another copy in the media folder called "nhat-titlebg-1.jpg".

  
  <img align="middle" width="300" 
  src="file:/home/brian/blogsdatabase/1247882990333/web/media/nhat-titlebg-1.jpg" 
  alt="Title Background" border="1" height="265">

It would appear that each time an image is added to a blog entry Thingamablog copies the file into the media folder, and if the image name is already there, the name of the file is changed to avoid overwriting the previous image.

So now I go ahead and publish the entry......

After publishing, all of the images have been uploaded to the server, even though only the last one imported is actually used in the blog. The URL of one of the images has been changed to:

  
  <img align="middle" width="300" 
  src="http://www.thekimerers.com/brian/blogs/TAMB/media/nhat-titlebg-1.jpg" 
  alt="Title Background" border="1" height="265">

This is good since it allows access to the image from all the pages out on the web. Unfortunately, I now have two images, "nhat-bodybg.jpg" and "nhat-titlebg.jpg", uploaded to the server that are not used in the blog. I can probably delete them safely without damaging the blog.

I would not call this a bug in Thingamablog. I would call it an eccentricity caused by a convenience feature, which is automatically importing images used in an entry. The important thing to remember is that I can include images from anywhere on my disk without having to import them myself. That happens automatically. As long as I only enter an image once in an entry, no duplicates will be created.

It works for me.

Now I need to figure out how to refer again to an image that I know is already out on the server.

Posted by Brian S. Kimerer at 9:58 AM
Edited on: Sunday, October 18, 2009 10:17 AM

This site and all of its contents are copyright Brian S. Kimerer 2009