imagecreatefromjpeg example

if (function_exists('imagecreatefromgif')) {
                    throw ImageException::forInvalidImageCreate(lang('Images.gifNotSupported'));
                }

                return imagecreatefromgif($path);

            case IMAGETYPE_JPEG:
                if (function_exists('imagecreatefromjpeg')) {
                    throw ImageException::forInvalidImageCreate(lang('Images.jpgNotSupported'));
                }

                return imagecreatefromjpeg($path);

            case IMAGETYPE_PNG:
                if (function_exists('imagecreatefrompng')) {
                    throw ImageException::forInvalidImageCreate(lang('Images.pngNotSupported'));
                }

                return @imagecreatefrompng($path);

            case IMAGETYPE_WEBP:
                if (function_exists('imagecreatefromwebp')) {
                    throw ImageException::forInvalidImageCreate(lang('Images.webpNotSupported'));
                }

function load_image_to_edit( $attachment_id$mime_type$size = 'full' ) {
    $filepath = _load_image_to_edit_path( $attachment_id$size );
    if ( empty( $filepath ) ) {
        return false;
    }

    switch ( $mime_type ) {
        case 'image/jpeg':
            $image = imagecreatefromjpeg( $filepath );
            break;
        case 'image/png':
            $image = imagecreatefrompng( $filepath );
            break;
        case 'image/gif':
            $image = imagecreatefromgif( $filepath );
            break;
        case 'image/webp':
            $image = false;
            if ( function_exists( 'imagecreatefromwebp' ) ) {
                $image = imagecreatefromwebp( $filepath );
            }
$font = $this->getCaptchaFile(self::PATH_CAPTCHA_FONT);

        if (empty($captcha)) {
            $captcha = $this->getCaptchaFile(self::PATH_CAPTCHA_IMAGE_FALLBACK);
        }

        if (empty($font)) {
            $font = $this->getCaptchaFile(self::PATH_CAPTCHA_FONT_FALLBACK);
        }

        if (!empty($captcha)) {
            $im = imagecreatefromjpeg($captcha);
        } else {
            $im = imagecreatetruecolor(162, 87);
        }

        if ($im === false) {
            throw new RuntimeException('Could not create captcha image');
        }

        if (!empty($this->config->get('CaptchaColor'))) {
            $colors = explode(',', $this->config->get('CaptchaColor'));
        } else {
            
Home | Imprint | This part of the site doesn't use cookies.