Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
02-15-2009, 09:54 PM #1
- Join Date
- Feb 2009
- Thanked 0 Times in 0 Posts
Replacing multiple images site-wide
I posted this on the Dreamweaver forum on Adobe.com but received two replies unhelpfully telling me to resort to using a database driven site for a catalogue I am developing. I am familiar with using dynamic pages but i do not want this as i want the catalogue to be very spider friendly.
Thanks in advance:
I am producing, in Dreamweaver, a large, image intensive portfolio site which acts as a catalogue for a client.
Each catalogue 'item' (there are hundreds, perhaps over a thousand) has about 7 or 8 images associated with it. The number of images varies, however. Usually 7 or 8, maybe 3 or maybe as much as 25. I have automated many stages in the process apart from this one.
What I want to be able to do is make one item page that i populate the whole site with. Each page coded to contain 30 sequencially numbered thumbnails. Of course, some items will have less than these 30 but there are no items with greater than 30. I then want to use some method in Dreamweaver that will automatically remove the code for all the broken images. To take an example, say there are only 3 images in an item's directory, only three images will not be broken in the code: thumb1, thumb2, thumb3. References to thumb4.jpg onwards, i want to be removed. Is there any way dreamweaver could identify the bolded text and remove across the entire site?:
I have no experience using regular expressions in find and replace, but maybe this is an answer?
Thanks for your help.
02-16-2009, 02:35 AM #2
- Join Date
- Apr 2003
- in my house
- Thanked 201 Times in 197 Posts
So to clarify what you mean (I am tired);
you want the outputted code to show only as many links as there are images? so if there are three images, you output three and if there are 30 you output 30?
I don't know if there is an ajax method but, it would be easiets with a server-side language like php or Perl.
Basically, it would open the relevant folder and build an array from its file content ~ the images. then you could loop thorugh the array to output whatever you need for each image. Likely better for ongoing management, you could put the image names into a db/textfile and use the same language to do loop through its contents. (same thing but just a different data source).
02-16-2009, 03:34 PM #3
- Join Date
- Jan 2005
- Memphis, TN
- Thanked 131 Times in 129 Posts
well as for removing dead links, you can remove those (well all of them) manually. Then in each page (PHP code ahead), you can write:
just change the "img1" to reflect your folders name. The loop will find each item in the folder and wrap them in image tags, so make sure there are only images in the folder.PHP Code:
$dir = opendir('img1');
$path = "img1";
while ($read = readdir($dir))
if ($read!='.' && $read!='..')
echo '<img src="'.$path.'/'.$read.'" />';