PHP or JAVA - Help getting a find and replace script to work.?

Christopher

New member
Ok hopefully this time this question makes sense to everyone...

I have a PHP code that runs and echo's out all the images it finds in a directory (folder on my site). The codes to show these images are below. It's a thumb image inside a link to the bigger image (I'm using lightbox to show them).

// These are my variables
$base = "folder location that all albums are stored in";
$thumbs = "folder location that the thumbs are stored in";
$get_album = "the name of the album the user choose to look at";
$images = "all the images found in this album";

// Now using a while loop every image is echo'd out with this code
echo "<table class='showthumbs'><a href='$base/$get_album/$images' rel='lightbox[1]' title='{$images}' /><img src='$base/$thumbs/$images'' /></a><br /></td></tr></table>";

NOW THIS IS WHAT I NEED HELP WITH - If you look at the TITLE tag in the code you'll notice it look like this... {$images} ...I would like to know how to do the following to this:

1) Once the original script is done, a new one (the one we're working on now) searches the page for... { } ...just the brackets and does the next step to them

2) Grab whats in it and add it to a new variable (Example: image_1.jpg) , then switch the files extension (Example: image_1.txt or image_1.php), now move on to step 3

3) NOW look inside a folder location I designate and look for a file that has this name (Example: We change image_1.jpg to image_1.txt and tell the script to look in folderA for it). Once a file is found with that name get the file contents (just the text) and replace the {} and what was inside them in step one with this text.

OVERVIEW - I know this isn't as hard as it sounds I just need some help. WHEN a person uploads an image to my site three things happen. Main image is saved in a folder, thumb image is saved in a folder, and the description is saved in a folder. BOTH the thumb and main image have the same name and extension still but the description only shares the same name, different extension.

We're trying to get this third file, the description, to display in the title tag of the appropriate image it belongs too.

I appreciate any help I can get here, 5 stars and best answer to whoever can give me something that accomplishes this!!! AND note: I will not be using a database for the images, I'm using directories for a reason. Now if you find someway to use a database for only the description then thats ok.
 
Back
Top