File manager - Edit - /home/webapp69.cm.in.th/u69319090001/69319090001/crop.php
Back
<?php $imagePath = 'resume.jpg'; if (!file_exists($imagePath)) { die("File not found\n"); } list($width, $height) = getimagesize($imagePath); echo "Dimensions: {$width}x{$height}\n"; $src = imagecreatefromjpeg($imagePath); if (!$src) { die("Failed to load JPEG image\n"); } // Profile picture coordinates: // Left: 9%, Top: 11.5%, Width: 33.5%, Height: 22% $x_p = (int)($width * 0.09); $y_p = (int)($height * 0.115); $w_p = (int)($width * (0.425 - 0.09)); $h_p = (int)($height * (0.335 - 0.115)); $profile = imagecrop($src, ['x' => $x_p, 'y' => $y_p, 'width' => $w_p, 'height' => $h_p]); if ($profile) { imagejpeg($profile, 'profile.jpg', 95); imagedestroy($profile); echo "Saved profile.jpg\n"; } else { echo "Failed to crop profile\n"; } // Cat picture coordinates: // Left: 71%, Top: 46.5%, Width: 19.5%, Height: 14% $x_c = (int)($width * 0.71); $y_c = (int)($height * 0.465); $w_c = (int)($width * (0.905 - 0.71)); $h_c = (int)($height * (0.605 - 0.465)); $cat = imagecrop($src, ['x' => $x_c, 'y' => $y_c, 'width' => $w_c, 'height' => $h_c]); if ($cat) { imagejpeg($cat, 'cat.jpg', 95); imagedestroy($cat); echo "Saved cat.jpg\n"; } else { echo "Failed to crop cat\n"; } imagedestroy($src); echo "Done!\n"; ?>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.34 |
proxy
|
phpinfo
|
Settings