2016-04-15 72 views
0

我目前正在嘗試使用PHP獲取圖像的寬高比。例如,使用這些值:獲取圖像寬高比

$thumb_width = 912; 
$thumb_height = 608; 

我將能夠得到縱橫比(16:9,3:2,2:3,等等)。因此,在這種情況下:

$ratio = '3:2'; 

的事情是:我不知道這將是什麼樣的新寬度或高度。所以我不能這樣做:(original height/original width) x new width = new height

任何想法?

注意:我不想調整圖像大小,只需計算其寬高比。

+1

可能重複的[計算圖像大小比例的大小調整](http://stackoverflow.com/questions/6594089/calculating-image-size-ratio-for-resizing) –

+0

這不會幫助你:http:///stackoverflow.com/questions/8044052/get-aspect-ratio-from-width-and-height-of-image-php-or-js?rq=1? –

+0

重複線程:http://stackoverflow.com/questions/6594089/calculating-image-size-ratio-for-resizing –

回答