开发者

phpthumb - disable output

$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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜