/home/techb158/exp.abdallabala.com/application/controllers
NameSizeModeActions
.DS_Store61480644editdlrm
accounts.php77290644editdlrm
admin.php67330644editdlrm
ajax.date-summary.php37960644editdlrm
ajax.expense-calendar.php10310644editdlrm
ajax.income-calendar.php9970644editdlrm
api.php75950644editdlrm
appearance.php20290644editdlrm
autologin.php15990644editdlrm
board.php9890644editdlrm
calendar.php49490644editdlrm
client.php630190644editdlrm
clx_api.php431780644editdlrm
console.php57000644editdlrm
contacts.php612540644editdlrm
cp.php15570644editdlrm
customers.php970644editdlrm
dashboard-alt.php320644editdlrm
dashboard.php365810644editdlrm
default.php1420644editdlrm
delete.php96310644editdlrm
demo.php6890644editdlrm
documents.php54930644editdlrm
editor.php21490644editdlrm
export.php48740644editdlrm
files.php12430644editdlrm
generate.php14680644editdlrm
help.php3810644editdlrm
ibtest.php2110644editdlrm
index.html1120644editdlrm
invoices.php581820644editdlrm
iview.php14100644editdlrm
jsonapi.php47010644editdlrm
jsonexport.php33120644editdlrm
legacy.php250644editdlrm
login.php64400644editdlrm
logout.php800644editdlrm
orders.php88460644editdlrm
plugins.php4260644editdlrm
ps.php100160644editdlrm
quotes.php393340644editdlrm
reorder.php24040644editdlrm
reports.php262270644editdlrm
search.php21250644editdlrm
settings.php1100910644editdlrm
sys_imgcrop.php39380644editdlrm
tags.php19130644editdlrm
tax.php50240644editdlrm
transactions.php285610644editdlrm
update.php18390644editdlrm
update_473.php527630644editdlrm
util.php180270644editdlrm
Edit: /home/techb158/exp.abdallabala.com/application/controllers/sys_imgcrop.php (3938B)
assign('_application_menu', 'contacts'); $ui->assign('_title', $_L['Accounts'] . '- ' . $config['CompanyName']); $action = $routes['1']; $user = User::_info(); $ui->assign('user', $user); switch ($action) { case 'save': $imagePath = "application/storage/temp/"; $allowedExts = [ "gif", "jpeg", "jpg", "png", "GIF", "JPEG", "JPG", "PNG", ]; $temp = explode(".", $_FILES["img"]["name"]); $extension = end($temp); if (in_array($extension, $allowedExts)) { if ($_FILES["img"]["error"] > 0) { $response = [ "status" => 'error', "message" => 'ERROR Return Code: ' . $_FILES["img"]["error"], ]; echo "Return Code: " . $_FILES["img"]["error"] . "
"; } else { $filename = $_FILES["img"]["tmp_name"]; $fg = str_replace(APP_URL . '/', '', $filename); list($width, $height) = getimagesize($fg); move_uploaded_file( $filename, $imagePath . $_FILES["img"]["name"] ); $response = [ "status" => 'success', "url" => APP_URL . '/' . $imagePath . $_FILES["img"]["name"], "width" => $width, "height" => $height, ]; } } else { $response = [ "status" => 'error', "message" => 'something went wrong', ]; } print json_encode($response); break; case 'crop': $imgUrl = $_POST['imgUrl']; $imgInitW = $_POST['imgInitW']; $imgInitH = $_POST['imgInitH']; $imgW = $_POST['imgW']; $imgH = $_POST['imgH']; $imgY1 = $_POST['imgY1']; $imgX1 = $_POST['imgX1']; $cropW = $_POST['cropW']; $cropH = $_POST['cropH']; $jpeg_quality = 100; $output_filename = "application/storage/pics/croppedImg_" . rand(); $fg = str_replace(APP_URL . '/', '', $imgUrl); $what = getimagesize($fg); switch (strtolower($what['mime'])) { case 'image/png': $img_r = imagecreatefrompng($fg); $source_image = imagecreatefrompng($fg); $type = '.png'; break; case 'image/jpeg': $img_r = imagecreatefromjpeg($fg); $source_image = imagecreatefromjpeg($fg); $type = '.jpeg'; break; case 'image/gif': $img_r = imagecreatefromgif($fg); $source_image = imagecreatefromgif($fg); $type = '.gif'; break; default: die('image type not supported'); } $resizedImage = imagecreatetruecolor($imgW, $imgH); imagecopyresampled( $resizedImage, $source_image, 0, 0, 0, 0, $imgW, $imgH, $imgInitW, $imgInitH ); $dest_image = imagecreatetruecolor($cropW, $cropH); imagecopyresampled( $dest_image, $resizedImage, 0, 0, $imgX1, $imgY1, $cropW, $cropH, $cropW, $cropH ); imagejpeg($dest_image, $output_filename . $type, $jpeg_quality); $response = [ "status" => 'success', "url" => APP_URL . '/' . $output_filename . $type, ]; print json_encode($response); break; default: echo 'action not defined'; }