Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $org_info = getimagesize($f);
- if ($value->scale && $value->scale != 1) {
- $scale = $value->scale;
- $scale_val = array(($org_info[0] * (float)$scale), ($org_info[1] * (float)$scale));
- $layer->fx('resize', $scale_val[0], $scale_val[1]); // Scale
- $scale_min_x = ($org_info[0] - $scale_val[0]) / 2;
- $scale_min_y = ($org_info[1] - $scale_val[1]) / 2;
- $n_x = str_replace('px', '',$value->x) * 4.36 + $scale_min_x;
- $n_y = str_replace('px', '',$value->y) * 4.65 + $scale_min_y;
- }else{
- $n_x = str_replace('px', '',$value->x) * 4.36;
- $n_y = str_replace('px', '',$value->y) * 4.65;
- $scale_val = $org_info;
- }
- if ($value->rotation) {
- $layer->fx('rotate', (360 - round((float)$value->rotation * 360)) ); // Rotation
- $img_temp = $_SERVER['DOCUMENT_ROOT'] . '/uploads/images/full/temp-' .$value->img;
- $layer->imageJpeg($img_temp);
- $lb = getimagesize($img_temp);
- $newSize = array(
- "width" => $lb[0],
- "height" => $lb[1]
- );
- $x = $n_x - ( $newSize["width"] - $scale_val[0]) / 2;
- $y = $n_y - ( $newSize["height"] - $scale_val[1]) / 2;
- }else{
- $x = $n_x;
- $y = $n_y;
- }
- $image = new Image\Canvas($name);
- $image->draw('layer', $layer, $x, $y, true);
- $image->imageJpeg($name);
- unset($image);
- unset($layer);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement