summaryrefslogtreecommitdiffstats
path: root/lib/preview/unknown.php
blob: 1cd270db6870e59731157f0c4078b6328176e40a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
 * Copyright (c) 2013 Frank Karlitschek frank@owncloud.org
 * Copyrigjt (c) 2013 Georg Ehrke georg@ownCloud.com
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
class OC_Preview_Unknown extends OC_Preview_Provider{

	public function getMimeType(){
		return '/.*/';
	}

	public static function getThumbnail($maxX,$maxY) {	
		// check if GD is installed
		if(!extension_loaded('gd') || !function_exists('gd_info')) {
			OC_Log::write('preview', __METHOD__.'(): GD module not installed', OC_Log::ERROR);
			return false;
		}
	
		// create a white image
		$image = imagecreatetruecolor($maxX, $maxY);
		$color = imagecolorallocate($image, 255, 255, 255);
		imagefill($image, 0, 0, $color);
	
		// output the image
		imagepng($image);
		imagedestroy($image);
	}

}

OC_Preview::registerProvider('OC_Preview_Unknown');