Jump to content
MakeWebGames

How to limit image size in players signatures?


dnenb

Recommended Posts

With CSS.

See Fiddle

 

<div id="PlayerSignature">
   <img src="http://www.takequickbreak.com/wp-content/uploads/2013/08/02-airborne-penguin-exits-water_1600.jpg" width="10000px" height="100000px" />
</div>

 

[css]

#PlayerSignature img {

max-height: 250px;

max-width: 250px;

}

[/css]

 

max-height browser support

wItpuZf.png

max-width browser support

6fYChFX.png

Have fun.

Edited by sniko
Added browser support information.
Link to comment
Share on other sites

With CSS.

See Fiddle

 

<div id="PlayerSignature">
   <img src="http://www.takequickbreak.com/wp-content/uploads/2013/08/02-airborne-penguin-exits-water_1600.jpg" width="10000px" height="100000px" />
</div>

 

[css]

#PlayerSignature img {

max-height: 250px;

max-width: 250px;

}

[/css]

 

max-height browser support

wItpuZf.png

max-width browser support

6fYChFX.png

Have fun.

Penguins... Always the penguins! :D

Link to comment
Share on other sites

I'd also suggest limiting the size or you're going to make your site struggle to download all the assets.

I'd run the image through the following function:

http://uk1.php.net/getimagesize

Here you could also check the width and height server side before even allowing the user to upload the image.

I'm just letting them use external images. Is there a way of checking the image size without downloading the image to my server?

Link to comment
Share on other sites

I'm just letting them use external images. Is there a way of checking the image size without downloading the image to my server?

I'm pretty sure getimagesize works remotely (IIRC). If not, download the file into a temporary file, and check there, then remove the temporary file after you're finished with it.

Link to comment
Share on other sites

  • 2 months later...
How much I can increase the size?

I don't really think there is a limit to the size that you can do. But my question is why would you want to increase the size?

The best thing is to use some sort of standard for your image because increasing it too much may distort the image and it will look like trash. Maybe have a look here and you can come up with a way to fit your needs:

http://www.codediesel.com/php/fixing-aspect-ratio-of-images-in-php/

Link to comment
Share on other sites

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.   Paste as plain text instead

  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...