Просмотр поста

.
Koenig
(\/)____o_O____(\/)

ramzes, не стоит заимствовать интерфейс , покажу кодом

старый код (+/-)

$handle = new upload($_FILES['image']);
                if ($handle->uploaded) {
                    // Обрабатываем фото
                    $handle->file_new_name_body = $cid;
                    $handle->allowed = array(
                        'image/jpeg',
                        'image/gif',
                        'image/png'
                    );
                    $handle->file_max_size = 1024 * $set['flsz'];
                    $handle->file_overwrite = true;
                    $handle->image_x = $handle->image_src_x;
                    $handle->image_y = $handle->image_src_y;
                    $handle->image_watermark = '../files/library/images/watermark.png';
                    $handle->image_watermark_x = 10;
                    $handle->image_watermark_y = 10;
                    $handle->image_watermark_position = 'LB';
                    $handle->image_watermark_no_zoom_in = true;
                    $handle->image_watermark_no_zoom_out = false;;
                    $handle->image_convert = 'png';
                    $handle->process('../files/library/images/orig/');
                    $err_image = $handle->error;
                    $handle->file_new_name_body = $cid;
                    $handle->file_overwrite = true;

                    if ($handle->image_src_y > 240) {
                        $handle->image_resize = true;
                        $handle->image_x = 240;
                        $handle->image_y = $handle->image_src_y * (240 / $handle->image_src_x);
                    } else {
                        $handle->image_x = $handle->image_src_x;
                        $handle->image_y = $handle->image_src_y;
                    }

                    $handle->image_watermark = '../files/library/images/watermark.png';
                    $handle->image_watermark_x = 10;
                    $handle->image_watermark_y = 10;
                    $handle->image_watermark_position = 'LB';
                    $handle->image_watermark_no_zoom_in = true;
                    $handle->image_watermark_no_zoom_out = false;
                    $handle->image_convert = 'png';
                    $handle->process('../files/library/images/big/');
                    $err_image = $handle->error;
                    $handle->file_new_name_body = $cid;
                    $handle->file_overwrite = true;
                    $handle->image_resize = true;
                    $handle->image_x = 32;
                    $handle->image_y = 32;
                    $handle->image_convert = 'png';
                    $handle->process('../files/library/images/small/');

                    if ($err_image) {
                        echo functions::display_error($lng_gal['error_uploading_photo'] . '<br /><a href="?act=addnew&amp;id=' . $id . '">' . $lng['repeat'] . '</a>');
                    }
                    $handle->clean();
                }



новый код (+/-)

// выборка
class Images extends Kimage {
public function add($file) {
        $original = $this->tmp($file);
        $name = $this->uniqid();
        $original->save($this->dir . self:S . 'orig' . self:S . $name . '.png');
        $original->reWidth(480)
                ->save($this->dir . self:S . 'big' . self:S . $name . '.png');
        $original->reWidth(64)
                ->save($this->dir . self:S . 'small' . self:S . $name . '.png');
    }
}