Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Problem displaying picture properly

images php coding issues or problems here.

Moderators: macek, egami, gesf

Problem displaying picture properly

Postby Nerijus7 » Tue Feb 26, 2013 2:22 pm

Hello,

I need to resize thumbnail and it must be 80px of width. The height doesnt matter, the main thing is to display picture properly.

This is my code:

$twidth = "80"; // Maximum Width For Thumbnail Images

$theight = "180"; // Maximum Height For Thumbnail Images

------------------------------------------------------------------------

if ($currheight > $currwidth) { // If Height Is Greater Than Width

$zoom = $twidth / $currheight; // Length Ratio For Width

$newheight = $theight; // Height Is Equal To Max Height

$newwidth = $currwidth * $zoom; // Creates The New Width

} else { // Otherwise, Assume Width Is Greater Than Height (Will Produce Same Result If Width Is Equal To Height)

$zoom = $twidth / $currwidth; // Length Ratio For Height

$newwidth = $twidth; // Width Is Equal To Max Width

$newheight = $currheight * $zoom; // Creates The New Height

}

Can anyone help?
Nerijus7
New php-forum User
New php-forum User
 
Posts: 1
Joined: Tue Feb 26, 2013 2:18 pm

Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron