Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2009
    Thanked 0 Times in 0 Posts

    Replacing multiple images site-wide

    Hi all,

    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.

    I want to (using some utility or otherwise - maybe javascript) find all broken images within my locally developed website and remove them from the page. Surely there is some utility that will do this for me? I have a static catalogue/portfolio area that is currently being developed. Please see below for further explanation of my query (taken from Adobe.com)

    Thanks in advance:

    Dear all,

    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?:

    <img src="thumb1.jpg">
    <img src="thumb2.jpg">
    <img src="thumb3.jpg">
    <img src="thumb4.jpg">
    <img src="thumb30.jpg">

    <img src="big1.jpg">

    I have no experience using regular expressions in find and replace, but maybe this is an answer?

    Thanks for your help.


  • #2
    Master Coder
    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).

    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #3
    Senior Coder
    Join Date
    Jan 2005
    Memphis, TN
    Thanked 132 Times in 130 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:

    PHP Code:
    $path "img1";
    while (
    $read readdir($dir))
    if (
    $read!='.' && $read!='..')
    '<img src="'.$path.'/'.$read.'" />';
    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.
    Stop making things so hard on yourself.
    i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts