Enter a (numeric only) value in both width and height fields.
'; return false; } return true; } public function doCalculate ($w_or_h,$teller,$w,$h) { //this is the actual calculation of the resulting values, and the embedding in the html code for a line if($w_or_h=="w"){ $result='width="'.$teller.'" height="'.round($h/($w/$teller)).'"'; $mid= substr(strval($h/($w/$teller)),-2)=='.5'?'~':''; } else{ $result='
width="'.round($w/($h/$teller)).'" height="'.$teller.'"'; $mid= substr(strval($w/($h/$teller)),-2)=='.5'?'~':''; } // with $mid we catch if the value is exact between two integers (.5). The only means is to add a value (~) to $mid // May be omitted, it's not of great importance return $result.' '.$mid.'
'; } } ?>Enter the orginal width and height of an image.
You will see the proportional values of width and height for the purpose of scaling down the image.
You can copy and paste the width and height values into the <img> tag of your html code.
When you see ~, the calculated width or height value is exactly in the middle between two integers, (e.g. 30.5) and is then rounded up (e.g. 31).