image gallery - it should be easier than this

Discussion in 'Javascript' started by Richard, Aug 6, 2006.

  1. Richard

    Richard Guest

    All I want to do is to read a list of the image files in my folder and
    display them on a page. That way I don't have to re-write the page, I
    can just upload extra images.

    I don't need fancy bells or whistles or slide shows or sliders or
    anything.

    The smallest google search I come up with offers a million pages, most
    of them bells and whistle types and I can't find the wood for the trees.

    Can anybody help please?

    Richard
    --
     
    Richard, Aug 6, 2006
    #1
    1. Advertising

  2. Richard

    Randy Webb Guest

    Richard said the following on 8/6/2006 4:46 AM:
    >
    > All I want to do is to read a list of the image files in my folder and
    > display them on a page.


    Unless you have server side scripting available then you won't be able
    to as javascript has no way to access the server file system.

    > That way I don't have to re-write the page, I can just upload extra images.
    > I don't need fancy bells or whistles or slide shows or sliders or anything.


    What you could possibly do is upload your images, get an FTP listing,
    copy it to a text file, create an array from the names, then upload that
    file as a .js file and include it in the page.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Aug 6, 2006
    #2
    1. Advertising

  3. Richard

    Richard Guest

    In message <>, Randy Webb
    <> writes

    >Richard said the following on 8/6/2006 4:46 AM:
    >> All I want to do is to read a list of the image files in my folder
    >>and display them on a page.

    >
    >Unless you have server side scripting available then you won't be able
    >to as javascript has no way to access the server file system.
    >
    >> That way I don't have to re-write the page, I can just upload extra images.
    >> I don't need fancy bells or whistles or slide shows or sliders or anything.

    >
    >What you could possibly do is upload your images, get an FTP listing,
    >copy it to a text file, create an array from the names, then upload
    >that file as a .js file and include it in the page.


    Hmm... this is where our definitions of "simple" differ. ;-)

    That is beyond my skills at the moment.

    I've found a program that does a neat version here on my own PC and
    generates the html page, as in:-

    http://www.topshareware.com/Actual-Web-Album-download-13520.htm

    Which can be set up to produce this:-

    http://www.squeaky.demon.co.uk/Freecycle/FAQ page/Gallery/gallery.html


    So far it's the best way I've found.


    <sigh>

    Thanks for your reply ;-)

    Richard

    --
     
    Richard, Aug 6, 2006
    #3
  4. Richard

    maya Guest

    Randy Webb wrote:
    > Richard said the following on 8/6/2006 4:46 AM:
    >>
    >> All I want to do is to read a list of the image files in my folder and
    >> display them on a page.

    >
    > Unless you have server side scripting available then you won't be able
    > to as javascript has no way to access the server file system.
    >
    >> That way I don't have to re-write the page, I can just upload extra
    >> images.
    >> I don't need fancy bells or whistles or slide shows or sliders or
    >> anything.

    >
    > What you could possibly do is upload your images, get an FTP listing,
    > copy it to a text file, create an array from the names, then upload that
    > file as a .js file and include it in the page.
    >


    I also have a CMS/images-display question.. is is at all possible,
    either with JS or server-side (which in my case would be either Java or
    PHP) to detect DIMENSIONS of the images? I do not want a system which
    sizes images for you.. I want images to display at exactly same
    dimension they are.. I was reading this the other day..

    http://www.alistapart.com/articles/magazinelayout/

    but he seems to be implying only way to to do this is by letting system
    determine dimensions of images.. is there another way?

    thanks..
     
    maya, Aug 6, 2006
    #4
  5. Richard

    Richard Guest

    OK...

    I can have a page with two frames and into frame2 I could load

    www.sompage.com.foldername/

    Which, with no index file present, will give me a listing of all the
    files in that folder.

    Given that these are image files, can I read and parse the text present
    in frame2 and parse it and hand it to javascript in frame 1 as a
    variable so that I can then load the image into a table cell?

    Richard, feeling brain damaged.

    --
     
    Richard, Aug 6, 2006
    #5
  6. Richard

    Randy Webb Guest

    maya said the following on 8/6/2006 10:36 AM:
    > Randy Webb wrote:
    >> Richard said the following on 8/6/2006 4:46 AM:
    >>>
    >>> All I want to do is to read a list of the image files in my folder
    >>> and display them on a page.

    >>
    >> Unless you have server side scripting available then you won't be able
    >> to as javascript has no way to access the server file system.
    >>
    >>> That way I don't have to re-write the page, I can just upload extra
    >>> images.
    >>> I don't need fancy bells or whistles or slide shows or sliders or
    >>> anything.

    >>
    >> What you could possibly do is upload your images, get an FTP listing,
    >> copy it to a text file, create an array from the names, then upload
    >> that file as a .js file and include it in the page.
    >>

    >
    > I also have a CMS/images-display question.. is is at all possible,
    > either with JS or server-side (which in my case would be either Java or
    > PHP) to detect DIMENSIONS of the images?


    PHP can read image dimensions on the server:

    <URL: http://us2.php.net/manual/en/function.getimagesize.php >

    Then, PHP can tell your script what it needs to know.


    > I do not want a system which sizes images for you.. I want images
    > to display at exactly same dimension they are.. I was reading this
    > the other day..
    > http://www.alistapart.com/articles/magazinelayout/


    Now I remember why I don't read alistapart anymore.

    > but he seems to be implying only way to to do this is by letting system
    > determine dimensions of images.. is there another way?


    That's not the implication I got from the article but there is another
    way, see above.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Aug 6, 2006
    #6
  7. Richard

    Randy Webb Guest

    Richard said the following on 8/6/2006 11:19 AM:
    >
    > OK...
    >
    > I can have a page with two frames and into frame2 I could load
    >
    > www.sompage.com.foldername/
    >
    > Which, with no index file present, will give me a listing of all the
    > files in that folder.


    That is what I was talking about doing. Open that page in your browser,
    copy the image names, and then strip out the text you don't want, wrap
    each name in "<imageName>" and make it an entry in an array. Save the
    file as a .js file and then include that file in the real page.

    > Given that these are image files, can I read and parse the text present
    > in frame2 and parse it and hand it to javascript in frame 1 as a
    > variable so that I can then load the image into a table cell?


    Maybe, depending on the browser and what kind of file/listing the server
    gives.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Aug 6, 2006
    #7
  8. Richard

    Richard Guest

    In message <>, Randy Webb
    <> writes

    >Richard said the following on 8/6/2006 11:19 AM:
    >> OK...
    >> I can have a page with two frames and into frame2 I could load
    >> www.sompage.com.foldername/
    >> Which, with no index file present, will give me a listing of all the
    >> files in that folder.

    >
    >That is what I was talking about doing. Open that page in your browser,
    >copy the image names, and then strip out the text you don't want, wrap
    >each name in "<imageName>" and make it an entry in an array. Save the
    >file as a .js file and then include that file in the real page.


    Now THIS is the bit that's currently beyond me. I'm self taught so I
    have a good few gaps. I don't mind learning and bashing code about
    until it begs for mercy - I take it you DO mean that I can do all that
    with javascript?

    >
    >> Given that these are image files, can I read and parse the text present
    >> in frame2 and parse it and hand it to javascript in frame 1 as a
    >> variable so that I can then load the image into a table cell?

    >
    >Maybe, depending on the browser and what kind of file/listing the
    >server gives.


    Hm...


    Richard
    --
     
    Richard, Aug 6, 2006
    #8
  9. Richard

    maya Guest

    Randy Webb wrote:
    > maya said the following on 8/6/2006 10:36 AM:
    >> Randy Webb wrote:
    >>> Richard said the following on 8/6/2006 4:46 AM:
    >>>>
    >>>> All I want to do is to read a list of the image files in my folder
    >>>> and display them on a page.
    >>>
    >>> Unless you have server side scripting available then you won't be
    >>> able to as javascript has no way to access the server file system.
    >>>
    >>>> That way I don't have to re-write the page, I can just upload extra
    >>>> images.
    >>>> I don't need fancy bells or whistles or slide shows or sliders or
    >>>> anything.
    >>>
    >>> What you could possibly do is upload your images, get an FTP listing,
    >>> copy it to a text file, create an array from the names, then upload
    >>> that file as a .js file and include it in the page.
    >>>

    >>
    >> I also have a CMS/images-display question.. is is at all possible,
    >> either with JS or server-side (which in my case would be either Java
    >> or PHP) to detect DIMENSIONS of the images?

    >
    > PHP can read image dimensions on the server:
    >
    > <URL: http://us2.php.net/manual/en/function.getimagesize.php >


    really? that's great!! :) thank you...
     
    maya, Aug 7, 2006
    #9
  10. Richard

    Randy Webb Guest

    Richard said the following on 8/6/2006 5:03 PM:
    > In message <>, Randy Webb
    > <> writes
    >
    >> Richard said the following on 8/6/2006 11:19 AM:
    >>> OK...
    >>> I can have a page with two frames and into frame2 I could load
    >>> www.sompage.com.foldername/
    >>> Which, with no index file present, will give me a listing of all the
    >>> files in that folder.

    >>
    >> That is what I was talking about doing. Open that page in your
    >> browser, copy the image names, and then strip out the text you don't
    >> want, wrap each name in "<imageName>" and make it an entry in an
    >> array. Save the file as a .js file and then include that file in the
    >> real page.

    >
    > Now THIS is the bit that's currently beyond me. I'm self taught so I
    > have a good few gaps. I don't mind learning and bashing code about
    > until it begs for mercy - I take it you DO mean that I can do all that
    > with javascript?


    You could write a script that would read the list from a web page,
    maybe, and then try to parse out the filenames. But it's a lot simpler
    to do it manually.

    var images = new Array()
    var num = 0;
    images[num++] = "name of first image";
    images[num++] = "name of second image";
    images[num++] = "name of third image";

    It is quite simple to do that with a text editor with a good
    Find/Replace in it. Remove all the text except image names, then
    Find/Replace.

    Find: ^P
    Replace with: ";^Pimages[num++]="

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Aug 7, 2006
    #10
  11. Richard

    Richard Guest

    In message <>, Randy Webb
    <> writes
    >Richard said the following on 8/6/2006 5:03 PM:
    >> In message <>, Randy Webb
    >><> writes
    >>
    >>> Richard said the following on 8/6/2006 11:19 AM:
    >>>> OK...
    >>>> I can have a page with two frames and into frame2 I could load
    >>>> www.sompage.com.foldername/
    >>>> Which, with no index file present, will give me a listing of all the
    >>>> files in that folder.
    >>>
    >>> That is what I was talking about doing. Open that page in your
    >>>browser, copy the image names, and then strip out the text you don't
    >>>want, wrap each name in "<imageName>" and make it an entry in an
    >>>array. Save the file as a .js file and then include that file in the
    >>>

    >> Now THIS is the bit that's currently beyond me. I'm self taught so
    >>I have a good few gaps. I don't mind learning and bashing code about
    >>until it begs for mercy - I take it you DO mean that I can do all that
    >>javascript?

    >
    >You could write a script that would read the list from a web page,
    >maybe, and then try to parse out the filenames. But it's a lot simpler
    >to do it manually.


    Yes boss, I know boss. Honest boss ;-) But the whole point is that I'd
    like to have a situation where I'm free to simply upload new images into
    the folder as often as I like, remove old ones etc. - and I DON'T have
    to re-write the gallery page every time I do it.

    I'm lazy that way. Quite apart from teaching myself a whole bunch of
    stuff as I go along I reckon I'll do less work over all now if I can do
    this than I would over the years to come re-writing the page to meet
    every new update.

    >
    >var images = new Array()
    >var num = 0;
    >images[num++] = "name of first image";
    >images[num++] = "name of second image";
    >images[num++] = "name of third image";
    >
    >It is quite simple to do that with a text editor with a good
    >Find/Replace in it. Remove all the text except image names, then
    >Find/Replace.
    >
    >Find: ^P
    >Replace with: ";^Pimages[num++]="


    I think we're just about there.

    Gawd knows if I can find it again but I saw a HTML parse script that
    worked quickly and easily with "start" and "end" strings.

    I think it was inclusive, But even so if I hand it "<a img src" and
    "</a>" to work with... I'd be home and dry. More or less ;-)

    All I've got to do now is find that one page again out of all the
    hundreds I've waded through over the weekend.

    Thanks.


    --
     
    Richard, Aug 7, 2006
    #11
  12. JRS: In article <>, dated Sun, 6
    Aug 2006 09:46:51 remote, seen in news:comp.lang.javascript, Richard
    <> posted :
    >
    >All I want to do is to read a list of the image files in my folder and
    >display them on a page. That way I don't have to re-write the page, I
    >can just upload extra images.


    I assume you have a Demon TAM account or similar, in which case you have
    a directory structure on Demon's server (which one might hope Web page
    javascript can access; but it cannot) and you should have a matching
    directory structure on your own computer, assumed to be a PC, which Web
    page javascript cannot possibly access, but which, if you are
    fenestrated, can be accessed by J[ava]script running under WSH, for
    which a better place to ask is the microsoft.public.scripting.*
    hierarchy.


    Your best move, ISTM, is to have a program or script which runs on your
    PC and generates a Web page listing the image files as links.

    This command line, run at a MS-DOS prompt and using COLS via sig line 3,
    does the basics if run in a directory containing Web pages :-
    dir *.* /b | COLS { 'a * 'href= q 1- q } 1- { '/a } { 'br }
    generating lines like :-
    <a href="estr-tbl.txt">estr-tbl.txt</a><br>


    and this for images :-
    dir *.* /b | COLS { 'p } 1- { 'br } { 'img * 'src= q 1- q }
    generating lines like :-
    <p>13.gif<br><img src="13.gif">


    In each case redirect to a file and use the copy command to join a
    respectable top and tail - the whole can be put in a batch file.


    On my site there are various programs & scripts for helping prepare the
    Web site; bit none do what you ask for.


    >Richard
    >--


    The Sig should follow the SigSep.


    --
    © John Stockton, Surrey, UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20; Win98. ©
    Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
    PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
    My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.
     
    Dr John Stockton, Aug 7, 2006
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dm1608
    Replies:
    13
    Views:
    726
    Kevin Spencer
    Feb 24, 2006
  2. b83503104
    Replies:
    5
    Views:
    581
    KC Wong
    May 25, 2004
  3. Ò»Ê×Ê«

    Is there something easier than ORM?

    Ò»Ê×Ê«, Feb 17, 2009, in forum: Python
    Replies:
    13
    Views:
    736
    Kevin Dangoor (Mozilla)
    Feb 26, 2009
  4. Replies:
    12
    Views:
    200
    Michele Dondi
    May 3, 2007
  5. Replies:
    0
    Views:
    82
Loading...

Share This Page