Hello guys i'm using batflat for a small project. The thing is want to save/display webP images too, How can it enabled/possible?. I try imagecreatefromwebp without luck. Any idea/help will be awesome. Gracias!

/**
     * Saves image
     *
     * @param string $path Path to location
     * @param string $type Filetype
     * @return boolean true if image was saved
     * @access public
     */
    public function save($path, $quality = 90)
    {
        $dir = dirname($path);
        $type = pathinfo($path, PATHINFO_EXTENSION);

        if (!file_exists($dir) || !is_dir($dir)) {
            return false;
        }

        if (!is_writable($dir)) {
            return false;
        }

        if ($type != 'gif' && $type != 'jpeg' && $type != 'jpg' && $type != 'png') {
            $type = $this->type;
            $path .= '.'.$type;
        }

        switch ($type) {
            case 'gif':
                imagegif($this->image, $path);
                break;

            case 'jpeg': case 'jpg':
                imagejpeg($this->image, $path, $quality);
                break;

            default:
                imagepng($this->image, $path);
        }

        return true;
    }

full code: https://github.com/sruupl/batflat/blob/master/inc/core/lib/Image.php

Re: WebP support for image upload 80 80

Reference your class php page at the top of your image page -

require_once dirname(__FILE__) . '/your_image_clas_file_name.php';

Then make the call to the save function in your class file -

$save_my_image = new Image();
//Remember that the class is called Image...
$path = "/the_path_it_needs_to_be_saved_to";
$quality = 80; //or 90 etc, whatever quality image you want. Keep in mind, the higher the quality, the higher the
//resources used to save image...
$save_my_image -> save($path, $quality);

And that is it, you can do the same for the show function...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.