Пример #1
0
    #NETCAT END
    require_once 'filemanager.class.php';
    $fm = new Filemanager();
    if (!auth()) {
        $fm->error($fm->lang('AUTHORIZATION_REQUIRED'));
        return false;
    }
    $x = $_REQUEST['x'];
    $y = $_REQUEST['y'];
    $w = $_REQUEST['w'];
    $h = $_REQUEST['h'];
    $cropped_img = img_helper::crop($img_src, $x, $y, $w, $h);
    if (img_helper::save($cropped_img, $img_src, $type) !== false) {
        // make new thumbnail
        $fm->setFileRoot($SUB_FOLDER . $config['rel_path']);
        $fm->get_thumbnail($img_src, true);
        return true;
    }
}
class img_helper
{
    /**
     * Check if GD extension is loaded
     * @access public
     * @return bool
     */
    public static function isgdloaded()
    {
        if (!extension_loaded('gd') && !extension_loaded('gd2')) {
            trigger_error("GD is not loaded", E_USER_WARNING);
            return false;