Jump to content

Limit height / width of embedded photo


davidcriniti

Recommended Posts

Hi folks,

 

I'm using this code to display a picture that is uploaded in a form.

 


print	"<img src='http://www.coast2kosci.com/mylongrun/test/photo_uploads/$imgx' width='300' height='300'  alt='Your photo' />";

 

At first I tried specifying only the width, without the height. But for tall photos, the display wasn't really what I was after.

 

Then I specified both width and height, which results in a mis-scaled photo.

 

Is there any way that I can specify the height and width atributes as a sort of maximum / or limiter. Ie:  If the height is greater than the width, limit the height to 300, and if the width is greater than the height, limit the width to 300?

 

Thanks for your time,

 

Dave

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.