Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 44

Thread: max-width property and PHP

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

    Default

    Have a look at this page... might be what you're looking for.

    First, try this... :\

    PHP Code:
    $ImageDisplay "<img src='$FileLocation' alt='' style="max-width:240px;max-height:320px;overflow:auto;" border='0' align='middle'>"
    Last edited by keyboard; 08-13-2012 at 02:27 AM.

  2. The Following User Says Thank You to keyboard For This Useful Post:

    KennyP (08-13-2012)

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

    Default

    Thanks keyboard. That code also works well in FF (as the previous code without overflow:auto;), but in IE the actual size of the image, 640X960, is still displaying and breaking up the page.

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

    Default

    The problem is that the max-width and height properties are not supported in Internet explorer, you can get around It as such:
    Code:
    width:expression(document.body.clientWidth > 240? "240px": "auto" );
    height:expression(document.body.clientHeight > 320? '320px": "auto" );
    "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

  5. The Following User Says Thank You to bernie1227 For This Useful Post:

    KennyP (08-13-2012)

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

    Default

    Thanks very much Bernie, but unfortunately again it is having no affect in IE.
    Is there anything else that can be tried?

    Thanks again
    Last edited by KennyP; 08-13-2012 at 04:15 AM.

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

    Default

    You couldtrysomeplain JavaScript
    Code:
    var imageWidth = document.getElementById('yourimageid');
    var imageHeight = document.getElementById('yourimageid');
    if(imageWidth.width < 240 && imageHeight.height < 320){
    var inside = true;
    }
    else{
    var inside = false;
    }
    if(inside = false){
    imageWidth.width = 240 ;
    imageHeight.heght = 320;
    }
    Remember to change the id's in the 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

  8. The Following User Says Thank You to bernie1227 For This Useful Post:

    KennyP (08-13-2012)

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

    Default

    KennyP, give this a go....


    PHP Code:
    $ImageDisplay "<img src='$FileLocation' alt='' style="width:expressiondocument.body.clientWidth 239 "240px" "auto" );max-width:240px;heightexpressionthis.scrollHeight 319 "320px" "auto" );max-height:320px;" border='0' align='middle'>"

  10. The Following User Says Thank You to keyboard For This Useful Post:

    KennyP (08-13-2012)

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

    Default

    That is in fact, the CSS I posted, and I somehow doubt the result will change
    "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

  12. The Following User Says Thank You to bernie1227 For This Useful Post:

    KennyP (08-13-2012)

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

    Default

    I know (it's not exactly the same)... I just wanted to check something... (Please still try it)

  14. The Following User Says Thank You to keyboard For This Useful Post:

    KennyP (08-13-2012)

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

    Default

    The only real difference in my view that will have occurred is that he may be putting the CSS rules in the correct place, as he may not have before.
    "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

  16. The Following User Says Thank You to bernie1227 For This Useful Post:

    KennyP (08-13-2012)

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

    Default

    Thanks very much guys or continuing to find a fix. The previous code did work in FF, but these last fixes don't work in either browser. I also upgraded from IE8 to IE9; again no difference.
    After all the years of developing IE, why can't they get it right?

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
  •