The form has two values (
Any takers?
Code: Select all
function make_thumb($src,$dest,$desired_width) {
$arr = getimagesize($src);
/* read the source image */
switch ($arr['mime']) {
case 'image/jpeg' : $source_image = imagecreatefromjpeg($src); break;
case 'image/png' : $source_image = imagecreatefrompng($src); break;
case 'image/gif' : $source_image = imagecreatefromgif($src); break;
default: $ext = '';
}
$width = imagesx($source_image);
$height = imagesy($source_image);
/* find the "desired height" of this thumbnail, relative to the desired width */
$desired_height = floor($height*($desired_width/$width));
/* create a new, "virtual" image */
$virtual_image = imagecreatetruecolor($desired_width,$desired_height);
/* copy source image at a resized size */
imagecopyresized($virtual_image,$source_image,0,0,0,0,$desired_width,$desired_height,$width,$height);
switch ($arr['mime']) {
case 'image/jpeg' : imagejpeg($virtual_image,$dest); break;
case 'image/png' : imagepng($virtual_image,$dest); break;
case 'image/gif' : imagegif($virtual_image,$dest); break;
default: $ext = '';
}
/* create the physical thumbnail image to its destination */
imagejpeg($virtual_image,$dest);
}
Code: Select all
else if (isset($_GET['print'])) {
echo '<img src="images/'.$_GET['print'].'" />';
?>
<form action="?printview" method="post">
<input type="hidden" name="image" value="<?php echo $_GET['print'];?>" />
<p style="display: none;">Paper size: <select name="format"><option value="letter" selected>Letter</option>
<option value="a4">A4</option></select></p>
<br /><p>Ratio: <br />
<input type="radio" name="ratio" value="yes" checked onClick="manage(this.value);"/>
<i class="fa fa-lock" style="font-size:30px"></i>
<input type="radio" name="ratio" value="no" onClick="manage(this.value);"/>
<i class="fa fa-unlock" style="font-size:30px"></i></p>
<p style="display: none;">Image measurements:
<select name="meassure"><option value="in" selected>inch</option><option value="cm">cm</option></select></p>
<p>Width (cm):<br /><input type="text" name="width" id="imgwidth" onKeyUp="calc();"/></p>
<p> <br />Height (cm)<br /><input type="text" name="height" id="imgheight" readonly/></select></p>
<input type="submit" />
</form>
<?php
}
Code: Select all
<p>Width (cm):<br /><input type="text" name="width" id="imgwidth" onKeyUp="calc();"/></p>
<p> <br />Height (cm)<br /><input type="text" name="height" id="imgheight" readonly/></select></p