Файл: photos/handler/upload.php
Строк: 29
<?php
if (!empty($_FILES))
{
require_once HOME.'/toolkit/AcImage.php';
function upload_photo($file) {
global $user_id, $id;
if(AcImage::isFileExists($_FILES[$file]['tmp_name'])) {} else {$err = lang('Файл не существует!','Файл не існує!');}
if($err == false && AcImage::isFileImage($_FILES[$file]['tmp_name']))
{
$file_name = time().'_'.rand(0000,9999).'.jpg';
AcImage::createImage($_FILES[$file]['tmp_name'])->saveAsJPG(HOME.'/files/photos/'.$user_id.'/'.$file_name);
AcImage::setQuality(80);
AcImage::createImage($_FILES[$file]['tmp_name'])->cropCenter('4pr', '4pr')->resizeByWidth(50)->saveAsJPG(HOME.'/files/photos/'.$user_id.'/icons/'.$file_name);
AcImage::createImage($_FILES[$file]['tmp_name'])->cropCenter('4pr', '4pr')->resizeByWidth(150)->saveAsJPG(HOME.'/files/photos/'.$user_id.'/mini/'.$file_name);
AcImage::createImage($_FILES[$file]['tmp_name'])->resizeByWidth(600)->resizeByHeight(600)->saveAsJPG(HOME.'/files/photos/'.$user_id.'/preview/'.$file_name);
mysql_query("UPDATE `users` SET count_photos=count_photos+1 WHERE `id` = '".$user_id."'");
mysql_query("UPDATE `photos_albums` SET count_photos=count_photos+1, `uptime` = '".time()."', `cover` = '".$file_name."' WHERE `id` = '".$id."'");
mysql_query("INSERT INTO `photos_file` SET `name` = '".$file_name."', `user_id` = '".$user_id."', `time` = '".time()."', `aid` = '".$id."'");
}
}
if (!empty($_FILES['file1'])) upload_photo('file1');
if (!empty($_FILES['file2'])) upload_photo('file2');
if (!empty($_FILES['file3'])) upload_photo('file3');
if ($ajax_query == true) exit;
else go(URL.'/photos/album.php?id='.$id.'&r='.rand(0000,9999));
}
?>