Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

HTML Question - Adding loads of links at once?

Options
  • 05-09-2004 8:24pm
    #1
    Moderators, Business & Finance Moderators, Music Moderators, Recreation & Hobbies Moderators Posts: 4,499 Mod ✭✭✭✭


    Howayas,

    This probably sounds like a llama question, but for the life of me I can't figure out how to add bulk links to pictures in HTML.

    Basically I have 500 odd jpg's (no not pr0n!) and I want a page with a background that lists each one, line by line and just by the filename (no paths). Something like this:

    Car.jpg
    House.jpg
    Your momma.jpg


    Where each one is a link to open that image in a new window.

    So I'm just wondering if theres any easy way to do 500 odd all at the same time rather than me adding each poxy link one at a time. I just have an old version of Frontpage and the web editor from Netscape, neither seem to allow me to add more than one link at a time.

    Any help appreciated,


Comments

  • Registered Users Posts: 7,739 ✭✭✭mneylon


    If you have access to php or perl you should be able to do it quite easily.


  • Moderators, Business & Finance Moderators, Music Moderators, Recreation & Hobbies Moderators Posts: 4,499 Mod ✭✭✭✭Blade


    I don't have access to them. I wouldn't have a clue about them either, I can just about handle basic HTML.


  • Closed Accounts Posts: 14,483 ✭✭✭✭daveirl


    This post has been deleted.


  • Registered Users Posts: 35,524 ✭✭✭✭Gordon


    Would you be able to open the dos prompt up and view the contents of your folder that contains the pictures?

    If so you can maybe copy the text and paste it into excel. Then add on each row the pre-url ie
    http://blahblah/fvfvd/
    and to the right of this on excel you would put the
    car.jpg
    house/jpg

    and then export data to a text file to copy into html file.

    May not work well that though, but if I was to do it I would scam around that way.


  • Closed Accounts Posts: 8,264 ✭✭✭RicardoSmith


    Photoshop or Thumbs PLus also will build a gallery for you.


  • Advertisement
  • Moderators, Business & Finance Moderators, Music Moderators, Recreation & Hobbies Moderators Posts: 4,499 Mod ✭✭✭✭Blade


    Thanks for all the help guys.

    I had a look at the idea of a gallery and found some nice software like Jalbum. The only problem is they all create thumbnails for an index but I really wanted just a list of links that people could just search through as theres 500+ of them. The filenames are the descriptions so a list of them should score nicely on search engines. I believe links score higher in search engines than normal text.

    Daveirl that snapGallery seems perfect, with a few alterations I can embed it nicely, thanks!

    Thanks for the suggestion Gordon. I was thinking along that line originally as I have some nice software that automates keystrokes and mouse movements for those monotonous tasks. But I figured there had to be an easier way!


  • Registered Users Posts: 35,524 ✭✭✭✭Gordon


    excel is just copy paste in one big go though.

    Anyway, good luck with it, pass me on any BIGJUGGZZ.jpgs if you find any!


  • Registered Users Posts: 1,967 ✭✭✭Dun


    If you are going down the command line route:

    dir /b *.jpg > files.txt

    will give you a bare output without things like file sizes, directories, etc.


  • Registered Users Posts: 44 andersde10


    hope this comes out correctly on the page but you can use a for loop from the command line that keeps appending the files to a html file - this will produce exactly what you were looking for. If you can't get it working just PM me.

    %G is the variable that contains the files name
    ^ is just an escape character to allow you to write < and >

    for /f "tokens=*" %G IN ('dir /b *.jpg') DO echo ^<a href="%G" ^> %G ^</a^>^<br^> >> out.html


  • Registered Users Posts: 1,967 ✭✭✭Dun


    Certainly works fine here.


  • Advertisement
  • Closed Accounts Posts: 16 mishmash


    FancyIndexes could be another approach to this problem.

    Apache The Definiative Guide


  • Moderators, Business & Finance Moderators, Music Moderators, Recreation & Hobbies Moderators Posts: 4,499 Mod ✭✭✭✭Blade


    andersde10 wrote:
    hope this comes out correctly on the page but you can use a for loop from the command line that keeps appending the files to a html file - this will produce exactly what you were looking for. If you can't get it working just PM me.

    %G is the variable that contains the files name
    ^ is just an escape character to allow you to write < and >

    for /f "tokens=*" %G IN ('dir /b *.jpg') DO echo ^<a href="%G" ^> %G ^</a^>^<br^> >> out.html

    I've already started doing it using that snapgallery software suggested and it's working out better than I planned. I can embed the index page itself in my site and when they click on one, it opens a plain page in the same window with the pic and the option to go previous and next through the gallery. Or they can click home and I can set that back to the proper page on my site with the index. I know I originally wanted them to open in a new window but having messed around with this method and adding a simple gallery, it's turned out really well.

    I gave your method a go out of interest as I'm sure it'll come in really handy for other stuff. But I couldn't get it to work as I'm not sure what I'm doing. May as well explain it here instead of a PM as other llamas like myself may benefit. When you say the variable that contain the files names, do you mean the text file that contains the file list that I would have created from a dir /b?

    I'm lost sorry..


  • Registered Users Posts: 44 andersde10


    not the easiest thing to explain but I'll have a go. If you use the command prompt and then move to the directory that contains the files you want to list then you should be able to type that line directly and it'll write the html out to the out.html file in the desired format.

    for /f "tokens=*" %G IN ('dir /b *.jpg') DO echo ^<a href="%G" ^> %G ^</a^>^<br^> >> out.html

    would produce
    <a href="file1.jpg">file1.jpg</a><br>
    <a href="file2.jpg">file2.jpg</a><br>
    <a href="file3.jpg">file3.jpg</a><br>
    <a href="file4.jpg">file4.jpg</a><br>
    .....

    when I said %G contains the files name it means that as it runs %G contains the result returned from one line of dir /b *.jpg e.g. "file1.jpg" and so on

    What actuall gets written out appears after the echo

    i.e ^<a href="%G" ^> %G ^</a^>^<br^>
    the ^ is just an escape character

    as another example, you could get the link to popup a new window by writing
    ^<a href="%G" target="_blank" ^> %G ^</a^>^<br^>

    if you wanted a list of say word doc instead you'd replace dir /b *.jpg with dir /b *.doc

    hope this explains it a little more, is kinda complex though, but works a treat.


Advertisement