function rotate($angle, $bg_color = '#000000')
{
// Perform the rotation
$rgba = $this->normalize_color($bg_color);
$bg_color = imagecolorallocatealpha($this->image, $rgba['r'], $rgba['g'], $rgba['b'], $rgba['a']);
$new = imagerotate($this->image, -$this->keep_within($angle, -360, 360), $bg_color);
imagesavealpha($new, true);
imagealphablending($new, true);
// Update meta data
$this->width = imagesx($new);
$this->height = imagesy($new);
$this->image = $new;
return $this;
}
$id = rand(1, 100) . date("dmYHis"); @unlink($app['data_path'] . "/konfig/{$data['gmb_header']}"); $data['gmb_header'] = ""; //echo "masuk";exit; try { $src_img = $_FILES["p_gmb_header"]['tmp_name']; $exif = exif_read_data($src_img); //list($width, $height, $type, $attr) = getimagesize($src_img); $imgx = new SimpleImage(); ## THUMB ############### $imgx->load($src_img); #-- check orientation ------------ if (!empty($exif['Orientation'])) { switch ($exif['Orientation']) { case 3: $imgx->rotate(180); break; case 6: $imgx->rotate(90); break; case 8: $imgx->rotate(-90); break; } } $imgx->thumbnail(500, 300); $imgx->save($app['data_path'] . "/konfig/gmb_header_" . $id . ".jpg"); $data['gmb_header'] = "gmb_header_" . $id . ".jpg"; } catch (Exception $e) { $_SESSION['msg'] = "gambar header gagal di unggah/upload ...."; $_SESSION['alt'] = "warning";