コード例 #1
0
ファイル: main.module.php プロジェクト: rigidus/ea
 function upload()
 {
     $dir = IMAGES_ROOT . 'index/';
     @mkdir(IMAGES_ROOT);
     @mkdir($dir);
     if (!empty($_FILES['file']['name'])) {
         $img_id = md5(date('YmdHis'));
         $file = $dir . $img_id . '.jpg';
         $file_m = $dir . $img_id . '_m.jpg';
         copy($_FILES['file']['tmp_name'], $file);
         images::src($file);
         images::thumb($file_m);
         images::setWidth(150);
         images::resize();
         $array = array('img_id' => $img_id, 'img_set' => '0');
         db::table('images');
         db::smartInsert($array);
     }
     headers::self();
 }
コード例 #2
0
ファイル: main.module.php プロジェクト: rigidus/ea
    function uploadPhotos()
    {
        $dir = IMAGES_ROOT . 'items/';
        $dir_path = IMAGES_PATH . 'items/';
        if (!empty($_FILES['item_photos']['name'])) {
            $file_id = md5(date('YmdHis'));
            $file = $dir . $file_id . '.jpg';
            $file_m = $dir . $file_id . '_m.jpg';
            $file_path = $dir_path . $file_id . '_m.jpg';
            copy($_FILES['item_photos']['tmp_name'], $file);
            images::src($file);
            images::thumb($file);
            images::setWidth(268);
            images::resize();
            images::src($file);
            images::thumb($file_m);
            images::setWidth(48);
            images::resize();
            $array = array('file_id' => $file_id, 'file_date' => 'NOW()', 'item_id' => 0);
            db::table('catalog_items_photos');
            db::smartInsert($array);
            copy($_FILES['file']['tmp_name'], $file);
            buffer::set('
			<li id="file_id_' . $file_id . '">
				<input type="hidden" name="photos_id[' . $file_id . ']" value="' . $file_id . '">
				<img src="' . $file_path . '" />
				<a href="javascript:void(null);" onclick="deletePhotosFile(\'' . $file_id . '\');" title="Удалить файл" class="ico ico16 ico_delete">&nbsp;</a>
			</li>');
        }
    }