In my database, I am building a table called "Photos" to organise an ever-increasing collection of fashion photographs (and their respective thumbnails). At the same time, I am organising my website's written articles in another table ("Articles").
My "Photos" table carries a field (ThumbPath) with the full "http://" path to the thumbnail of a photo, and a field (FullPath) with the full "http://" path to the full-sized photo. So far, so good.
My "Articles" table contains a 'longblob' field called "Content" to contain the HTML-tagged text that makes up each specific article that I have written. In many of my articles, I will need to feature thumbnails of photos from the "Photos" table. HOWEVER, these will not be placed at uniform points, and while one article might contain ten thumbnail images, another might only have one or two....
Therefore, I am told that I could place Object IDs - for example: <? placephoto=6435 ?> - into the HTML code where I would normally put <img> tags for thumbnails, and then create a function in my PHP scripts to convert any of these object references into HTML. Correct?
The conversion would begin by finding the correct image record in the database. Then it would generate HTML <img> tags at that point in the article, based around the thumbnail path from that record, and thus hopefully show a thumbnail on the article at the specific place I placed the object ID. What I would also need to do is wrap the generated <img> tags with an <a href> to point to a PHP script specifcally for displaying the full-sized images one-at-a-time from the database, this time placing the image ID number at the end of the link, for example /showimage.php?=6435
Is my train of thought correct so far?
So ultimately, I want to convert any occurences of:
<? placephoto=xxx ? >
into this:
<a href="/pathtoscript/showimage.php?=xxx">
<img border="1" src="http://www.pathtoimage.com/thumbnails/"></a>
...I am 99.9% sure that this is done by regular expressions or function calls, but I'm absolutely stuck on coding it properly. (The PHP manual is confusing me more than its helping!)...
HELP PLEASE!!!