SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    thumbnail to full img and txt description on the fly...help plz

    hi there.
    i have put together a script from various sources where the user clicks on a thumbnail of an image and is sent to a new window with the full size picture together with description which will be placed in a .txt file or.js file.

    i am having trouble including the description file.
    i have tried SSI and importing a .js file both suggested by the others on other threads but they dont work.
    the description file doesnt have to be .txt or .js...it just needs to work! also, i have tried the code below and the image comes up ok but without the description and when i view source, the code looks ok.

    any guidance would be appreciated:

    PHP Code:
    <script language="javascript"
    <!--
    function 
    newShot(imageSrc)
    {

    var 
    text='<html>\n';
    text+='<head><title>headline</title>\n';
    text+='<STYLE TYPE=\"text/css\">\n';
    text+='h1{ font-family: verdana; font-size: 36; color: #808080 }\n';
    text+='</STYLE>\n';
    text+='</head>\n';
    text+='<body>\n';
    text+='<p><h1 align=\"center\">title</h1></p>\n';
    text+='<p>\n';
    text+='<TABLE WIDTH=\"100%\" HEIGHT=\"100%\"><TR><TD align=\"center\" valign=\"top\">';
    text+='<img align=\"center\" src=\"/dir\/'+imageSrc+'\.jpg\" width=\"400\" height=\"400\">\n';
    text+='</TD></TR>\n';
    text+='<TR><TD>\n';
    text+='<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"/dir\/'+imageSrc+'\.js\"';
    text+='></SCRIPT';
    text+='>\n';
    text+='</TD></TR>\n';
    text+='</TABLE>\n';
    text+='</p>\n';
    text+='</body>\n';
    text+='</html>\n';

    customWin window.open("","","resizable,width='100%',height='100%'"); 
    customWin.document.open(); 
    customWin.document.write(text);
    customWin.document.close();
    }

    //--> 
    </script> 
    .js file:
    PHP Code:
    document.write('<p>it works</p>'); 
    Last edited by kamstar; Nov 22, 2001 at 23:02.

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    never mind...created a work around and its now working.

    all i did was lose the .js file and included a function where if (picname==xx){doc write html stuff here} else if (picname==yy){etc...}

  3. #3
    SitePoint Guru siphilp's Avatar
    Join Date
    Nov 2001
    Location
    Fife, Scotland
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Another Possible Way?

    Hi,
    If your using PHP or ASP why not use there functionality rather than Javascript.

    E.g. Your thumb name is call "harry.jpg" and your normal sizeone is called "Harry_Normal.jpg", and description is "Harry.inc"

    so when you click on the thumbnail it passes over an ID

    so you click on the thumbnail

    Link would be /mak_me_big.asp?Big=Harry


    You could make mak_me_big.asp a certain size etc so then it would be

    <% Dim What
    What= Request.querystring("big")

    response.write "<img /Images/" & What&"_normal.jpg>"
    response.write "<!--Include File=" & What &".inc-->"
    %>

    This could be placed into tables etc. You just need to make sure that the include file is formated right.

    Hope this makes sense i just threw this together, can you tell


    Simon

  4. #4
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    simon
    thanks for your reply and email.

    the webspace doesnt have any db facilities which is why i have to use client side scripting.

    thanks for your suggestions on php and asp, i use php a lot and it would have been perfect for this, but i'm limited by the clients webspace.

    thanks...k

  5. #5
    SitePoint Guru siphilp's Avatar
    Join Date
    Nov 2001
    Location
    Fife, Scotland
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Confusion

    Sorry just seen your PHP tags in the source you provided.

    Also another thing you could do is take use of Dreamweavers built in photo album feature. This does what your asking for client side ;-)


    Si

  6. #6
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The way he has it coded is cleaner then DW code
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  7. #7
    SitePoint Guru siphilp's Avatar
    Join Date
    Nov 2001
    Location
    Fife, Scotland
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Completely Agree

    Hi,
    I agree with you completely. Just depends on if your lazy, not a coder, or hardly any time . Thinking about it nearly all "built in helpful dreamweaver functions" create a load of code which is not needed.

    Si


Bookmarks

Posting Permissions

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