designing4u.de Yet Another Coding Blog

14May/080

Class for picture upload with fix width and height

For one of my web 2.0 projects I had to develop a solution for users to upload their images with fixed width and height. Basically my customer wanted to display profile images on the start page, but the requirement was to display each of them in a div container with fixed width and height. Because I'm not a CSS guru and I didn't want to set negative background position to display only parts of the images or because of the problems, which CSS has with different browsers, I came up with a solution, which does that pretty good. My class has a simple configuration and according to the width or height of an image uploaded by a user, resizes it to predefined width or height and places it according to the case vertically or horizontally in the center. This description might be confusing right now, but if you read this post to the end I hope you will know, what I meant.

   

Pages

Categories

Blogroll

Archive

Meta