Jump to content

Resize Image?


vexious

Recommended Posts

I need some help, and i'm really not sure how to go about doing this. I have a script which will output images onto a page, however images uploaded are of all various sizes. I want all images to have the width of 200 but i want the proportions to be retained. How would i go about doing this? Here the bit of code that displays the image:

 

<div style="text-align: center; padding-top: 5px;">
                <a href="$appUrl?t=details&id={$row['id']}&author_id={$row['author_id']}">
                    <img src="$imageBaseUrl{$row['file_name']}" alt="{$row['tags']}" />
                </a>

Link to comment
https://forums.phpfreaks.com/topic/83488-resize-image/
Share on other sites

I also want it to increase the width of images less than 200 was my main problem. (I know it will look stretched but i need it to)

 

Basically I want all images width 200, and height doesn't matter, just proportional from the orginial size..

 

Not sure if this is possible really

 

example:

if the original Image was: Width:80 height:100

 

The image displayed should be:

Width 200; Height:160

Link to comment
https://forums.phpfreaks.com/topic/83488-resize-image/#findComment-424803
Share on other sites

thnaks mate, one last question,

 

how would i put that code into:

 

<div style="text-align: center; padding-top: 5px;">
                <a href="$appUrl?t=details&id={$row['id']}&author_id={$row['author_id']}">
                    <img src="$imageBaseUrl{$row['file_name']}" alt="{$row['tags']}" />
                </a>

Link to comment
https://forums.phpfreaks.com/topic/83488-resize-image/#findComment-424828
Share on other sites

You could get the size of the image using getimagesize() and use the height and width HTML attributes on the img tag. You could also generate a new image with the new size dynamically at each request or you could one time generate a new image and store it on the server. It would be best to choose one of the two last options.

Link to comment
https://forums.phpfreaks.com/topic/83488-resize-image/#findComment-424948
Share on other sites

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.