PHP: How to dynamically resize image in your page?

Every php programmer/developer have to resize images in web pages.
There are a lot of ways available through JavaScript, jQuery and PHP.
Here is very simple way to resize image temporarily but proportionally.
You can still keep big image file in you in your folder but when you are displaying you can make is smaller.

Jquery and java script some times does not work. So PHP way is very useful.


 ($inputwidth/$inputheight)) {
            $outputwidth = $inputwidth;
            $outputheight = ($inputwidth * $height)/ $width;
        }

        elseif (($width/$height) < ($inputwidth/$inputheight)) {
            $outputwidth = ($inputheight * $width)/ $height;
            $outputheight = $inputheight;
        }

        elseif (($width/$height) == ($inputwidth/$inputheight)) {
            $outputwidth = $inputwidth;
            $outputheight = $inputheight;
            }

echo '';

?>
Share

One thought on “PHP: How to dynamically resize image in your page?

  1. windows 7 on ps3 youtube

    Howdy very cool website!! Guy .. Beautiful .. Amazing .
    . I will bookmark your blog and take the feeds additionally?
    I am satisfied to seek out a lot of helpful info right here in the publish, we
    need work out extra techniques on this regard, thank you
    for sharing. . . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *