phpthumb - disable output

888 views Asked by At

$phpThumb->GenerateThumbnail() or $phpThumb->RenderToFile() create a output with header information and the thumbnail. How can i disable it? I need to store the thumbnail without a return of the thumbnail on the harddisk.

Here is my code:

        require 'class.phpthumb/phpthumb.class.php';
        $phpThumb = new phpThumb();
        $phpThumb->config_temp_directory        = 'thumbnails_c/'; 
        $phpThumb->config_cache_directory       = 'thumbnails_c/'; 
        $phpThumb->config_cache_disable_warning = true;
        $phpThumb->cache_maxage                 = 86400 * 30;
        $phpThumb->cache_maxsize                = 10 * 1024 * 1024;
        $phpThumb->config_cache_force_passthru  = false;            
        $phpThumb->setSourceData($file_data);
        $phpThumb->setParameter('w', 45);
        $phpThumb->setParameter('h', 32);
        $phpThumb->setParameter('zc', 1);
        $phpThumb->setParameter('JPEGquality', 100);
        $phpThumb->setParameter('f', 'jpeg');               

        if ($phpThumb->GenerateThumbnail()) {

            if ($phpThumb->RenderToFile($path_to_the_new_file)) {

                // return the data as an array
                return array(
                    'thumbnail'         => $phpThumb->OutputThumbnail(),
                    'contenttype'       => 'image/jpeg',
                );

            } else {
                // error
                return false;
            }
        } else {
            // error
            return false;
        }

greetings!

1

There are 1 answers

0
glomad On

From the readme:

Calling as an object (not using phpThumb.php):

NOTE: most people don't need to and should not do this. If you just want to display resized images, please just use phpThumb.php, not the object mode. To render output to one (or more) files instead of the browser, you should skip phpThumb.php and instantiate your own object. Please take a look at /demo/phpThumb.demo.object.php for details.