Page 4 of 5 FirstFirst ... 2345 LastLast
Results 31 to 40 of 44

Thread: max-width property and PHP

  1. #31
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    I meant, in the script, there is a document.getElementById on the image's id, did you change that to the I'd of your image?
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  2. #32
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Actually, try:
    Code:
    var imageWidth = document.getElementById('yourimageid');
    var imageHeight = document.getElementById('yourimageid');
    function changeSize(){
    if(imageWidth.width < 240 && imageHeight.height < 320){
    var inside = true;
    }
    else{
    var inside = false;
    }
    if(inside = false){
    imageWidth.width = 240 ;
    imageHeight.heght = 320;
    }
    }
    And then in your body tag, change:
    Code:
    <body>
    To:
    Code:
    <body onload="changeSize()">
    And also remember to change the part in red to the actuall id of the outputted image.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  3. #33
    Join Date
    Dec 2009
    Location
    NY NY USA
    Posts
    230
    Thanks
    158
    Thanked 1 Time in 1 Post

    Default

    Where do I integrate it?

    Code:
    $ImageDisplay = $ImageDisplay = "<img src='$FileLocation' alt='' style='width:expression( document.body.clientWidth > 239 ? 240px : auto );max-width:240px;height: expression( this.scrollHeight > 319 ? 320px : auto );max-height:320px;' border='0' align='middle'>";  
    }


    The following is the display box in which all images appear. There is no particular ID...

    Code:
    <div style="margin-left:0; height:320px; " ><div style=" padding-top:<?php echo($DownFromTop); ?>px;"><?php echo($ImageDisplay); ?></div></div>
    Last edited by KennyP; 08-13-2012 at 08:26 AM.

  4. #34
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    In the head, you want some script tags, ie:
    Code:
    <script type="text/javascript">
    </script>
    And you want to put it between them. Remember to change the id in the script, so if the id of your image is "image" change the red parts that I posted to "image". Also remember to modify the body tag.

  5. #35
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    also,
    Please use the forum's bbcode tags to make it more readable:

    for php code............[php] <?php /* code goes here */ ?> [/php]
    for html...............[html] <!-- markup goes here -->.....[/html]
    for js/css/other.......[code] code goes here................[/code]
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  6. #36
    Join Date
    Mar 2011
    Posts
    2,145
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default

    I just had a crazy idea (probably won't work).
    If you haven't tried this already, try this -

    Code:
    $ImageDisplay = "<img src='$FileLocation' alt='' style='width:inherit;height:inherit;' border='0' align='middle'>";
    Last edited by keyboard; 08-13-2012 at 08:56 AM.

  7. #37
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    That win't work, because of the non-escaped double quote in it,.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  8. #38
    Join Date
    Mar 2011
    Posts
    2,145
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

  9. #39
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Nice edit there keyboard, there was a quote in alt, which you then removed.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  10. #40
    Join Date
    Dec 2009
    Location
    NY NY USA
    Posts
    230
    Thanks
    158
    Thanked 1 Time in 1 Post

    Default

    No. That one didn't work in either browser. The previous code which works in FF is now reloaded.

    Maybe we could try hypnosis. We'll tell IE that it is really FF and maybe it will behave like it

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
  •