note 104658 deleted from configuration.changes by danbrown
| From: | danbrown@php.net | Date: | Wed, 29 Jun 2011 15:38:00 +0000 |
| Subject: | note 104658 deleted from configuration.changes by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181056@lists.php.net to get a copy of this message | ||
Note Submitter: rohitkumar at cftechno dot com
----
<?php
$image = '../images/img_1554.jpg';
$size = getimagesize($image);
$img = imagecreatefromjpeg($image);
$exif = exif_read_data($image);
$str = array();
$items = array('ShutterSpeedValue', 'ApertureValue',
â¥'FocalLength');
foreach ($items as $item) {
if (isset($exif[$item])) {
$parts = split('/', $exif[$item]);
if ($item == 'ShutterSpeedValue') {
$str[] = 'Shutter Speed: 1/'.
(int) pow(2, $parts[0] / $parts[1]). ' sec';
} else if ($item == 'ApertureValue') {
$str[] = 'Aperture: '.
round(exp(($parts[0]/$parts[1]) * 0.5 * log(2)),
â¥1);
} else if ($item == 'FocalLength') {
$str[] = 'FocalLength: '.
round($parts[0] / $parts[1], 2). ' mm';
}
}
}
if (isset($exif['OwnerName'])) {
$str[] = '© '. $exif['OwnerName'];
}
imagestring(
$img, 5,
3, $size[1] â 21,
implode('; ', $str),
imagecolorallocate($img, 0, 0, 0)
);
imagestring(
$img, 5,
2, $size[1] â 20,
implode('; ', $str),
imagecolorallocate($img, 0, 255, 0)
);
header('Content-Type: image/jpeg');
imagejpeg($img, '', 90);
?>