Jump to content

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

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.