_resize example


    public function resize( $max_w$max_h$crop = false ) {
        if ( ( $this->size['width'] == $max_w ) && ( $this->size['height'] == $max_h ) ) {
            return true;
        }

        $resized = $this->_resize( $max_w$max_h$crop );

        if ( is_gd_image( $resized ) ) {
            imagedestroy( $this->image );
            $this->image = $resized;
            return true;

        } elseif ( is_wp_error( $resized ) ) {
            return $resized;
        }

        return new WP_Error( 'image_resize_error', __( 'Image resize failed.' )$this->file );
    }
return $this;
        }

        $this->width  = $width;
        $this->height = $height;

        if ($maintainRatio) {
            $this->masterDim = $masterDim;
            $this->reproportion();
        }

        return $this->_resize($maintainRatio);
    }

    /** * Crops the image to the desired height and width. If one of the height/width values * is not provided, that value will be set the appropriate value based on offsets and * image dimensions. * * @param int|null $x X-axis coord to start cropping from the left of image * @param int|null $y Y-axis coord to start cropping from the top of image * * @return $this */
Home | Imprint | This part of the site doesn't use cookies.