<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Intervention\Image\ImageManagerStatic as Image; class ImageUtil { public static function base64Src($Mk0ir, $BTuN4 = 'png') { if (!in_array($BTuN4, array('png', 'gif', 'jpg', 'jpeg'))) { return null; } return 'data:' . FileUtil::mime($BTuN4) . ';base64,' . base64_encode($Mk0ir); } public static function limitSizeAndDetectOrientation($ceAjB, $ojnuE = 1000, $sKe4e = 1000) { try { goto VqS0T; xubGD: $K8Smw = $S2FiA->height(); goto eyUer; dktJq: if (!empty($Ey8ZH['Orientation'])) { switch (intval($Ey8ZH['Orientation'])) { case 2: goto NrDrR; keB6G: break; goto Swc53; NrDrR: $S2FiA->flip(); goto xa4Ed; xa4Ed: $CMk3B = true; goto keB6G; Swc53: case 3: goto KOz8C; Y8FJG: break; goto qsNWJ; KOz8C: $S2FiA->rotate(180); goto K1b2u; K1b2u: $CMk3B = true; goto Y8FJG; qsNWJ: case 4: goto OPoOD; vC1QK: $CMk3B = true; goto U5WK4; U5WK4: break; goto CFPcE; OPoOD: $S2FiA->rotate(180); goto kTsB_; kTsB_: $S2FiA->flip(); goto vC1QK; CFPcE: case 5: goto SXW4k; zU8ge: $S2FiA->flip(); goto Uv6P4; Uv6P4: $CMk3B = true; goto OwMlE; OwMlE: break; goto lsA0y; SXW4k: $S2FiA->rotate(90); goto zU8ge; lsA0y: case 6: goto sYMRz; gYRwc: break; goto f1ccN; TzZN3: $CMk3B = true; goto gYRwc; sYMRz: $S2FiA->rotate(-90); goto TzZN3; f1ccN: case 7: goto xCW7O; YN_v8: $S2FiA->flip(); goto xL9Kg; xL9Kg: $CMk3B = true; goto KyK22; xCW7O: $S2FiA->rotate(90); goto YN_v8; KyK22: break; goto MwUP5; MwUP5: case 8: goto x98YI; x98YI: $S2FiA->rotate(90); goto VV_hS; nPlL6: break; goto Z_SUJ; VV_hS: $CMk3B = true; goto nPlL6; Z_SUJ: } } goto NySdo; NySdo: $XJUHT = $S2FiA->width(); goto xubGD; xIE5Q: $Ey8ZH = @exif_read_data($ceAjB); goto mmVay; yELjM: if ($CMk3B) { $S2FiA->save($ceAjB); } goto Sgxr8; mmVay: $S2FiA = Image::make($ceAjB); goto dktJq; VqS0T: $CMk3B = false; goto xIE5Q; eyUer: if ($XJUHT > $ojnuE || $K8Smw > $sKe4e) { goto LPRO8; QSX1r: if ($XJUHT > $ojnuE) { $S2FiA->resize($ojnuE, intval($ojnuE * $K8Smw / $XJUHT)); } goto CNgIS; CNgIS: if ($K8Smw > $sKe4e) { $S2FiA->resize(intval($sKe4e * $XJUHT / $K8Smw), $sKe4e); } goto FRHaZ; LPRO8: $CMk3B = true; goto QSX1r; FRHaZ: } goto yELjM; Sgxr8: } catch (\Exception $vBRkZ) { throw $vBRkZ; } } }