|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
img size problems
Hallo programers!
I have a problem with displaying images. I have an aplication where user can upload pictures, but very little place for displaying them. So, this is what I need: Function that compare width and height of image and then, resize it like that: maximum width is 350px and maximum height is 110px . If picture is bigger, it is resized in the way that doesn't lose proportions if not, nothing happends. Can anybody help me? It should be java script, aplication is written in asp. |
|
#2
|
|||
|
|||
|
Do you need the code or logic?
|
|
#3
|
||||
|
||||
|
Quote:
maybe you should put this in the javascript forum ![]() |
|
#4
|
|||
|
|||
|
hey i moved this thread into where it will warrant more responses.
__________________
Apache Expert |
|
#5
|
||||
|
||||
|
Javascript can't get the actual dimensions of the image, only the
dimensions you give the browser. Not only that, there is no way to guarantee that the client has JavaScript enabled or even installed on their machine; so I would suggest you do this on the server with asp/php or whatever -> Get the dimensions, do some checking, and create the html dynamically accordingly. /My tuppence... |
|
#6
|
||||
|
||||
|
I was going to question the use of Javascript, but I see that Agent47 already has.
Definately has to be done server-side... perhaps on-upload... Alternatively, have a fixed width and simply hardcode the IMG dimensions in the HTML. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > img size problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|