Jump to content

PHP - Make images fit according to size


Gamerz

Recommended Posts

Alright, so when the user uploads an image, it gets displayed onto a viewing page. So on the viewing page, I would like to make the image fit to the left...so the comment box can be shown without having to scroll to the side.

 

I would be assuming to use thumbnails, but I'm not sure how that will work. As you can see below, the image is perfect...fits on the left, and also can handle the comment box just right. So what if a user uploads a full size image that occupies everything on the screen? The comment box wouldn't be visible until you scroll all the way to the right.

 

Basically, I would like to make a thumbnail of the picture so it fits according to the size, but I'm not sure what to do....

 

 

Here is the perfect image that I want every image to be like:

lol.jpg

Link to comment
https://forums.phpfreaks.com/topic/198069-php-make-images-fit-according-to-size/
Share on other sites

You have 2 choices:

 

<img src="filename" height="50px" width="50px">

 

OR

 

http://www.php.net/manual/en/refs.utilspec.image.php

 

There's a lot of content on php.net

 

But the function you would want (I believe) is:

http://www.php.net/manual/en/function.imagecopyresampled.php

Archived

This topic is now archived and is closed to further replies.

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