Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Feb 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CSS Image resizing

    Hi Everyone,

    I have some images which are uploaded to my server by a third party daily. Now these could be in a range of different sizes, so I need to fix the max-width element. Now I know this doesnt work in IE, so I was told I could use...

    Code:
    .imggallery {
    	max-width: 125px;
    	width:expression(this.width > 125 ? "125px" : this.width);
    }
    
    .mainpic {
    	max-width: 350px;
    	width:expression(this.width > 350 ? "350px" : this.width);
    }
    However in FireFox this works great, but in IE the images dont appear?

    This is how i reference the images...

    Code:
    <img src="<%=varImageDir%><%=varP%>" alt="" border="0" class="mainpic" name="mainpic">
    Thanks for any help in advance.

    Loz

  • #2
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Quote Originally Posted by lozhowlett View Post
    However in FireFox this works great, but in IE the images dont appear?
    I always thought expressions were an IE only thing? Either way, since you're using a CMS of some sort, is there a reason why you don't implement the image resizing on the server end?

    For these sorts of situations I tend to use a PHP script called phpthumb(); it's great at dynamically resizing elements and caches the results as well. You need some sort of image library installed on the server and, of course, PHP. Maybe this will work for you…

  • #3
    New Coder
    Join Date
    Feb 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    Yes there is - because the images are uploaded directly from some software at the clients, so I have no scripting control over the upload, plus there are about 1000 fotos daily, so would be a lot of processing and bandwidth doing it server side.

    I dont use PHP, i code in ASP. But thank you -

    The only solution I want to use in CSS or javascript for this element.

    Many thanks.

  • #4
    New Coder
    Join Date
    Feb 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    can anyone think of a solution for this one? really struggling! thank you.

  • #5
    Regular Coder
    Join Date
    Sep 2007
    Location
    Raleigh, NC
    Posts
    273
    Thanks
    7
    Thanked 59 Times in 52 Posts
    Quote Originally Posted by lozhowlett View Post
    Hi,

    Yes there is - because the images are uploaded directly from some software at the clients, so I have no scripting control over the upload, plus there are about 1000 fotos daily, so would be a lot of processing and bandwidth doing it server side.

    I dont use PHP, i code in ASP. But thank you -

    The only solution I want to use in CSS or javascript for this element.

    Many thanks.
    But if you only control the width of the image with CSS or HTML the client has to download the entire image even if it's displayed as a thumbnail. This could cripple the page for users with a slow connection, especially if the gallery contains lots of large images.

    Also if bandwidth is a concern then generating thumbnails and caching is definitely what you want. Not to mention doing this server-side gives you access to the dimensions of the image to noodle with. 1000 photographs isn't a lot of server load, even if it had to perform that concurrently. Your engine should be able to handle it.
    Last edited by vtjustinb; 10-01-2007 at 04:11 PM.


  •  

    Posting Permissions

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