@ -25,24 +25,27 @@
*/
class OC_Image {
protected $resource = false; // tmp resource.
protected $imagetype = IMAGETYPE_PNG; // Default to png if file type isn't evident.
protected $bit_depth = 24;
protected $filepath = null;
protected $imageType = IMAGETYPE_PNG; // Default to png if file type isn't evident.
protected $mimeType = "image/png"; // Default to png
protected $bitDepth = 24;
protected $filePath = null;
private $fileInfo;
/**
* @brief Get mime type for an image file.
* @param $filepath The path to a local image file.
* @returns string The mime type if the it could be determined, otherwise an empty string.
*/
static public function getMimeTypeForFile($filep ath) {
static public function getMimeTypeForFile($fileP ath) {
// exif_imagetype throws "read error!" if file is less than 12 byte
if (filesize($filep ath) > 11) {
$imagetype = exif_imagetype($filep ath);
if (filesize($fileP ath) > 11) {
$imageType = exif_imagetype($fileP ath);
}
else {
$imaget ype = false;
$imageT ype = false;
}
return $imagetype ? image_type_to_mime_type($imaget ype) : '';
return $imageType ? image_type_to_mime_type($imageT ype) : '';
}
/**
@ -50,14 +53,19 @@ class OC_Image {
* @param $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function.
* @returns bool False on error
*/
public function __construct($imager ef = null) {
public function __construct($imageR ef = null) {
//OC_Log::write('core',__METHOD__.'(): start', OC_Log::DEBUG);
if(!extension_loaded('gd') || !function_exists('gd_info')) {
OC_Log::write('core', __METHOD__.'(): GD module not installed', OC_Log::ERROR);
return false;
}
if(!is_null($imageref)) {
$this->load($imageref);
if (\OC_Util::fileInfoLoaded()) {
$this->fileInfo = new finfo(FILEINFO_MIME_TYPE);
}
if(!is_null($imageRef)) {
$this->load($imageRef);
}
}
@ -74,7 +82,7 @@ class OC_Image {
* @returns int
*/
public function mimeType() {
return $this->valid() ? image_type_to_mime_type($this->imagetype) : '';
return $this->valid() ? $this->mimeType : '';
}
/**
@ -157,30 +165,30 @@ class OC_Image {
* @returns bool
*/
public function save($filep ath=null) {
if($filepath === null & & $this->filep ath === null) {
public function save($fileP ath=null) {
if($filePath === null & & $this->fileP ath === null) {
OC_Log::write('core', __METHOD__.'(): called with no path.', OC_Log::ERROR);
return false;
} elseif($filepath === null & & $this->filep ath !== null) {
$filepath = $this->filep ath;
} elseif($filePath === null & & $this->fileP ath !== null) {
$filePath = $this->fileP ath;
}
return $this->_output($filep ath);
return $this->_output($fileP ath);
}
/**
* @brief Outputs/saves the image.
*/
private function _output($filep ath=null) {
if($filep ath) {
if (!file_exists(dirname($filep ath)))
mkdir(dirname($filep ath), 0777, true);
if(!is_writable(dirname($filep ath))) {
private function _output($fileP ath=null) {
if($fileP ath) {
if (!file_exists(dirname($fileP ath)))
mkdir(dirname($fileP ath), 0777, true);
if(!is_writable(dirname($fileP ath))) {
OC_Log::write('core',
__METHOD__.'(): Directory \''.dirname($filep ath).'\' is not writable.',
__METHOD__.'(): Directory \''.dirname($fileP ath).'\' is not writable.',
OC_Log::ERROR);
return false;
} elseif(is_writable(dirname($filepath)) & & file_exists($filepath) & & !is_writable($filep ath)) {
OC_Log::write('core', __METHOD__.'(): File \''.$filep ath.'\' is not writable.', OC_Log::ERROR);
} elseif(is_writable(dirname($filePath)) & & file_exists($filePath) & & !is_writable($fileP ath)) {
OC_Log::write('core', __METHOD__.'(): File \''.$fileP ath.'\' is not writable.', OC_Log::ERROR);
return false;
}
}
@ -188,30 +196,30 @@ class OC_Image {
return false;
}
$retv al = false;
switch($this->imaget ype) {
$retV al = false;
switch($this->imageT ype) {
case IMAGETYPE_GIF:
$retval = imagegif($this->resource, $filep ath);
$retVal = imagegif($this->resource, $fileP ath);
break;
case IMAGETYPE_JPEG:
$retval = imagejpeg($this->resource, $filep ath);
$retVal = imagejpeg($this->resource, $fileP ath);
break;
case IMAGETYPE_PNG:
$retval = imagepng($this->resource, $filep ath);
$retVal = imagepng($this->resource, $fileP ath);
break;
case IMAGETYPE_XBM:
$retval = imagexbm($this->resource, $filep ath);
$retVal = imagexbm($this->resource, $fileP ath);
break;
case IMAGETYPE_WBMP:
$retval = imagewbmp($this->resource, $filep ath);
$retVal = imagewbmp($this->resource, $fileP ath);
break;
case IMAGETYPE_BMP:
$retval = imagebmp($this->resource, $filepath, $this->bit_d epth);
$retVal = imagebmp($this->resource, $filePath, $this->bitD epth);
break;
default:
$retval = imagepng($this->resource, $filep ath);
$retVal = imagepng($this->resource, $fileP ath);
}
return $retv al;
return $retV al;
}
/**
@ -233,7 +241,21 @@ class OC_Image {
*/
function data() {
ob_start();
$res = imagepng($this->resource);
switch ($this->mimeType) {
case "image/png":
$res = imagepng($this->resource);
break;
case "image/jpeg":
$res = imagejpeg($this->resource);
break;
case "image/gif":
$res = imagegif($this->resource);
break;
default:
$res = imagepng($this->resource);
OC_Log::write('core', 'OC_Image->data. Couldn\'t guess mimetype, defaulting to png', OC_Log::INFO);
break;
}
if (!$res) {
OC_Log::write('core', 'OC_Image->data. Error getting image data.', OC_Log::ERROR);
}
@ -261,11 +283,11 @@ class OC_Image {
OC_Log::write('core', 'OC_Image->fixOrientation() No image loaded.', OC_Log::DEBUG);
return -1;
}
if(is_null($this->filepath) || !is_readable($this->filep ath)) {
if(is_null($this->filePath) || !is_readable($this->fileP ath)) {
OC_Log::write('core', 'OC_Image->fixOrientation() No readable file path set.', OC_Log::DEBUG);
return -1;
}
$exif = @exif_read_data($this->filep ath, 'IFD0');
$exif = @exif_read_data($this->fileP ath, 'IFD0');
if(!$exif) {
return -1;
}
@ -351,19 +373,19 @@ class OC_Image {
* @param $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function or a file resource (file handle ).
* @returns An image resource or false on error
*/
public function load($imager ef) {
if(is_resource($imager ef)) {
if(get_resource_type($imager ef) == 'gd') {
$this->resource = $imager ef;
public function load($imageR ef) {
if(is_resource($imageR ef)) {
if(get_resource_type($imageR ef) == 'gd') {
$this->resource = $imageR ef;
return $this->resource;
} elseif(in_array(get_resource_type($imager ef), array('file', 'stream'))) {
return $this->loadFromFileHandle($imager ef);
} elseif(in_array(get_resource_type($imageR ef), array('file', 'stream'))) {
return $this->loadFromFileHandle($imageR ef);
}
} elseif($this->loadFromFile($imager ef) !== false) {
} elseif($this->loadFromFile($imageR ef) !== false) {
return $this->resource;
} elseif($this->loadFromBase64($imager ef) !== false) {
} elseif($this->loadFromBase64($imageR ef) !== false) {
return $this->resource;
} elseif($this->loadFromData($imager ef) !== false) {
} elseif($this->loadFromData($imageR ef) !== false) {
return $this->resource;
} else {
OC_Log::write('core', __METHOD__.'(): couldn\'t load anything. Giving up!', OC_Log::DEBUG);
@ -390,62 +412,62 @@ class OC_Image {
* @param $imageref The path to a local file.
* @returns An image resource or false on error
*/
public function loadFromFile($imagep ath=false) {
public function loadFromFile($imageP ath=false) {
// exif_imagetype throws "read error!" if file is less than 12 byte
if(!@is_file($imagepath) || !file_exists($imagepath) || filesize($imagep ath) < 12 | | ! is_readable ( $ imagep ath ) ) {
if(!@is_file($imagePath) || !file_exists($imagePath) || filesize($imageP ath) < 12 | | ! is_readable ( $ imageP ath ) ) {
// Debug output disabled because this method is tried before loadFromBase64?
OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: '.$imagep ath, OC_Log::DEBUG);
OC_Log::write('core', 'OC_Image->loadFromFile, couldn\'t load: '.$imageP ath, OC_Log::DEBUG);
return false;
}
$itype = exif_imagetype($imagep ath);
switch($it ype) {
$iType = exif_imagetype($imageP ath);
switch ($iT ype) {
case IMAGETYPE_GIF:
if (imagetypes() & IMG_GIF) {
$this->resource = imagecreatefromgif($imagep ath);
$this->resource = imagecreatefromgif($imageP ath);
} else {
OC_Log::write('core',
'OC_Image->loadFromFile, GIF images not supported: '.$imagep ath,
'OC_Image->loadFromFile, GIF images not supported: '.$imageP ath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_JPEG:
if (imagetypes() & IMG_JPG) {
$this->resource = imagecreatefromjpeg($imagep ath);
$this->resource = imagecreatefromjpeg($imageP ath);
} else {
OC_Log::write('core',
'OC_Image->loadFromFile, JPG images not supported: '.$imagep ath,
'OC_Image->loadFromFile, JPG images not supported: '.$imageP ath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_PNG:
if (imagetypes() & IMG_PNG) {
$this->resource = imagecreatefrompng($imagep ath);
$this->resource = imagecreatefrompng($imageP ath);
} else {
OC_Log::write('core',
'OC_Image->loadFromFile, PNG images not supported: '.$imagep ath,
'OC_Image->loadFromFile, PNG images not supported: '.$imageP ath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_XBM:
if (imagetypes() & IMG_XPM) {
$this->resource = imagecreatefromxbm($imagep ath);
$this->resource = imagecreatefromxbm($imageP ath);
} else {
OC_Log::write('core',
'OC_Image->loadFromFile, XBM/XPM images not supported: '.$imagep ath,
'OC_Image->loadFromFile, XBM/XPM images not supported: '.$imageP ath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_WBMP:
if (imagetypes() & IMG_WBMP) {
$this->resource = imagecreatefromwbmp($imagep ath);
$this->resource = imagecreatefromwbmp($imageP ath);
} else {
OC_Log::write('core',
'OC_Image->loadFromFile, WBMP images not supported: '.$imagep ath,
'OC_Image->loadFromFile, WBMP images not supported: '.$imageP ath,
OC_Log::DEBUG);
}
break;
case IMAGETYPE_BMP:
$this->resource = $this->imagecreatefrombmp($imagep ath);
$this->resource = $this->imagecreatefrombmp($imageP ath);
break;
/*
case IMAGETYPE_TIFF_II: // (intel byte order)
@ -474,14 +496,15 @@ class OC_Image {
default:
// this is mostly file created from encrypted file
$this->resource = imagecreatefromstring(\OC\Files\Filesystem::file_get_contents(\OC\Files\Filesystem::getLocalPath($imagep ath)));
$it ype = IMAGETYPE_PNG;
$this->resource = imagecreatefromstring(\OC\Files\Filesystem::file_get_contents(\OC\Files\Filesystem::getLocalPath($imageP ath)));
$iT ype = IMAGETYPE_PNG;
OC_Log::write('core', 'OC_Image->loadFromFile, Default', OC_Log::DEBUG);
break;
}
if($this->valid()) {
$this->imagetype = $itype;
$this->filepath = $imagepath;
$this->imageType = $iType;
$this->mimeType = image_type_to_mime_type($iType);
$this->filePath = $imagePath;
}
return $this->resource;
}
@ -496,6 +519,9 @@ class OC_Image {
return false;
}
$this->resource = @imagecreatefromstring($str);
if ($this->fileInfo) {
$this->mimeType = $this->fileInfo->buffer($str);
}
if(is_resource($this->resource)) {
imagealphablending($this->resource, false);
imagesavealpha($this->resource, true);
@ -520,6 +546,9 @@ class OC_Image {
$data = base64_decode($str);
if($data) { // try to load from string data
$this->resource = @imagecreatefromstring($data);
if ($this->fileInfo) {
$this->mimeType = $this->fileInfo->buffer($data);
}
if(!$this->resource) {
OC_Log::write('core', 'OC_Image->loadFromBase64, couldn\'t load', OC_Log::DEBUG);
return false;
@ -539,16 +568,16 @@ class OC_Image {
* < / p >
* @return resource an image resource identifier on success, < b > FALSE< / b > on errors.
*/
private function imagecreatefrombmp($filen ame) {
if (!($fh = fopen($filen ame, 'rb'))) {
trigger_error('imagecreatefrombmp: Can not open ' . $filen ame, E_USER_WARNING);
private function imagecreatefrombmp($fileN ame) {
if (!($fh = fopen($fileN ame, 'rb'))) {
trigger_error('imagecreatefrombmp: Can not open ' . $fileN ame, E_USER_WARNING);
return false;
}
// read file header
$meta = unpack('vtype/Vfilesize/Vreserved/Voffset', fread($fh, 14));
// check for bitmap
if ($meta['type'] != 19778) {
trigger_error('imagecreatefrombmp: ' . $filen ame . ' is not a bitmap!', E_USER_WARNING);
trigger_error('imagecreatefrombmp: ' . $fileN ame . ' is not a bitmap!', E_USER_WARNING);
return false;
}
// read image header
@ -559,7 +588,7 @@ class OC_Image {
}
// set bytes and padding
$meta['bytes'] = $meta['bits'] / 8;
$this->bit_d epth = $meta['bits']; //remember the bit depth for the imagebmp call
$this->bitD epth = $meta['bits']; //remember the bit depth for the imagebmp call
$meta['decal'] = 4 - (4 * (($meta['width'] * $meta['bytes'] / 4)- floor($meta['width'] * $meta['bytes'] / 4)));
if ($meta['decal'] == 4) {
$meta['decal'] = 0;
@ -595,7 +624,7 @@ class OC_Image {
$p = 0;
$vide = chr(0);
$y = $meta['height'] - 1;
$error = 'imagecreatefrombmp: ' . $filen ame . ' has not enough data!';
$error = 'imagecreatefrombmp: ' . $fileN ame . ' has not enough data!';
// loop through the image data beginning with the lower left corner
while ($y >= 0) {
$x = 0;
@ -658,7 +687,7 @@ class OC_Image {
break;
default:
trigger_error('imagecreatefrombmp: '
. $filen ame . ' has ' . $meta['bits'] . ' bits and this is not supported!',
. $fileN ame . ' has ' . $meta['bits'] . ' bits and this is not supported!',
E_USER_WARNING);
return false;
}
@ -678,24 +707,24 @@ class OC_Image {
* @param $maxsize The maximum size of either the width or height.
* @returns bool
*/
public function resize($maxs ize) {
public function resize($maxS ize) {
if(!$this->valid()) {
OC_Log::write('core', __METHOD__.'(): No image loaded', OC_Log::ERROR);
return false;
}
$width_o rig=imageSX($this->resource);
$height_o rig=imageSY($this->resource);
$ratio_orig = $width_orig/$height_o rig;
$widthO rig=imageSX($this->resource);
$heightO rig=imageSY($this->resource);
$ratioOrig = $widthOrig/$heightO rig;
if ($ratio_o rig > 1) {
$new_height = round($maxsize/$ratio_o rig);
$new_width = $maxs ize;
if ($ratioO rig > 1) {
$newHeight = round($maxSize/$ratioO rig);
$newWidth = $maxS ize;
} else {
$new_width = round($maxsize*$ratio_o rig);
$new_height = $maxs ize;
$newWidth = round($maxSize*$ratioO rig);
$newHeight = $maxS ize;
}
$this->preciseResize(round($new_width), round($new_h eight));
$this->preciseResize(round($newWidth), round($newH eight));
return true;
}
@ -704,8 +733,8 @@ class OC_Image {
OC_Log::write('core', __METHOD__.'(): No image loaded', OC_Log::ERROR);
return false;
}
$width_o rig=imageSX($this->resource);
$height_o rig=imageSY($this->resource);
$widthO rig=imageSX($this->resource);
$heightO rig=imageSY($this->resource);
$process = imagecreatetruecolor($width, $height);
if ($process == false) {
@ -715,13 +744,13 @@ class OC_Image {
}
// preserve transparency
if($this->imagetype == IMAGETYPE_GIF or $this->imaget ype == IMAGETYPE_PNG) {
if($this->imageType == IMAGETYPE_GIF or $this->imageT ype == IMAGETYPE_PNG) {
imagecolortransparent($process, imagecolorallocatealpha($process, 0, 0, 0, 127));
imagealphablending($process, false);
imagesavealpha($process, true);
}
imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $width_orig, $height_o rig);
imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightO rig);
if ($process == false) {
OC_Log::write('core', __METHOD__.'(): Error resampling process image '.$width.'x'.$height, OC_Log::ERROR);
imagedestroy($process);
@ -742,19 +771,19 @@ class OC_Image {
OC_Log::write('core', 'OC_Image->centerCrop, No image loaded', OC_Log::ERROR);
return false;
}
$width_o rig=imageSX($this->resource);
$height_o rig=imageSY($this->resource);
if($width_orig === $height_o rig and $size==0) {
$widthO rig=imageSX($this->resource);
$heightO rig=imageSY($this->resource);
if($widthOrig === $heightO rig and $size==0) {
return true;
}
$ratio_orig = $width_orig/$height_o rig;
$width = $height = min($width_orig, $height_o rig);
$ratioOrig = $widthOrig/$heightO rig;
$width = $height = min($widthOrig, $heightO rig);
if ($ratio_o rig > 1) {
$x = ($width_o rig/2) - ($width/2);
if ($ratioO rig > 1) {
$x = ($widthO rig/2) - ($width/2);
$y = 0;
} else {
$y = ($height_o rig/2) - ($height/2);
$y = ($heightO rig/2) - ($height/2);
$x = 0;
}
if($size>0) {
@ -772,7 +801,7 @@ class OC_Image {
}
// preserve transparency
if($this->imagetype == IMAGETYPE_GIF or $this->imaget ype == IMAGETYPE_PNG) {
if($this->imageType == IMAGETYPE_GIF or $this->imageT ype == IMAGETYPE_PNG) {
imagecolortransparent($process, imagecolorallocatealpha($process, 0, 0, 0, 127));
imagealphablending($process, false);
imagesavealpha($process, true);
@ -832,9 +861,9 @@ class OC_Image {
OC_Log::write('core', __METHOD__.'(): No image loaded', OC_Log::ERROR);
return false;
}
$width_o rig=imageSX($this->resource);
$height_o rig=imageSY($this->resource);
$ratio = $width_orig/$height_o rig;
$widthO rig=imageSX($this->resource);
$heightO rig=imageSY($this->resource);
$ratio = $widthOrig/$heightO rig;
$newWidth = min($maxWidth, $ratio*$maxHeight);
$newHeight = min($maxHeight, $maxWidth/$ratio);
@ -868,7 +897,7 @@ if ( ! function_exists( 'imagebmp') ) {
* @param int $compression [optional]
* @return bool < b > TRUE< / b > on success or < b > FALSE< / b > on failure.
*/
function imagebmp($im, $filen ame='', $bit=24, $compression=0) {
function imagebmp($im, $fileN ame='', $bit=24, $compression=0) {
if (!in_array($bit, array(1, 4, 8, 16, 24, 32))) {
$bit = 24;
}
@ -879,14 +908,14 @@ if ( ! function_exists( 'imagebmp') ) {
imagetruecolortopalette($im, true, $bits);
$width = imagesx($im);
$height = imagesy($im);
$colors_n um = imagecolorstotal($im);
$rgb_q uad = '';
$colorsN um = imagecolorstotal($im);
$rgbQ uad = '';
if ($bit < = 8) {
for ($i = 0; $i < $colors_n um; $i++) {
for ($i = 0; $i < $colorsN um; $i++) {
$colors = imagecolorsforindex($im, $i);
$rgb_q uad .= chr($colors['blue']) . chr($colors['green']) . chr($colors['red']) . "\0";
$rgbQ uad .= chr($colors['blue']) . chr($colors['green']) . chr($colors['red']) . "\0";
}
$bmp_d ata = '';
$bmpD ata = '';
if ($compression == 0 || $bit < 8 ) {
$compression = 0;
$extra = '';
@ -904,35 +933,35 @@ if ( ! function_exists( 'imagebmp') ) {
$bin |= $index < < $k;
$i++;
}
$bmp_d ata .= chr($bin);
$bmpD ata .= chr($bin);
}
$bmp_d ata .= $extra;
$bmpD ata .= $extra;
}
}
// RLE8
else if ($compression == 1 & & $bit == 8) {
for ($j = $height - 1; $j >= 0; $j--) {
$last_i ndex = "\0";
$same_n um = 0;
$lastI ndex = "\0";
$sameN um = 0;
for ($i = 0; $i < = $width; $i++) {
$index = imagecolorat($im, $i, $j);
if ($index !== $last_index || $same_n um > 255) {
if ($same_n um != 0) {
$bmp_data .= chr($same_num) . chr($last_i ndex);
if ($index !== $lastIndex || $sameN um > 255) {
if ($sameN um != 0) {
$bmpData .= chr($same_num) . chr($lastI ndex);
}
$last_i ndex = $index;
$same_n um = 1;
$lastI ndex = $index;
$sameN um = 1;
}
else {
$same_n um++;
$sameN um++;
}
}
$bmp_d ata .= "\0\0";
$bmpD ata .= "\0\0";
}
$bmp_d ata .= "\0\1";
$bmpD ata .= "\0\1";
}
$size_quad = strlen($rgb_q uad);
$size_data = strlen($bmp_d ata);
$sizeQuad = strlen($rgbQ uad);
$sizeData = strlen($bmpD ata);
}
else {
$extra = '';
@ -940,7 +969,7 @@ if ( ! function_exists( 'imagebmp') ) {
if ($padding % 4 != 0) {
$extra = str_repeat("\0", $padding);
}
$bmp_d ata = '';
$bmpD ata = '';
for ($j = $height - 1; $j >= 0; $j--) {
for ($i = 0; $i < $width; $i++) {
$index = imagecolorat($im, $i, $j);
@ -950,27 +979,27 @@ if ( ! function_exists( 'imagebmp') ) {
$bin |= ($colors['red'] >> 3) < < 10 ;
$bin |= ($colors['green'] >> 3) < < 5 ;
$bin |= $colors['blue'] >> 3;
$bmp_d ata .= pack("v", $bin);
$bmpD ata .= pack("v", $bin);
}
else {
$bmp_d ata .= pack("c*", $colors['blue'], $colors['green'], $colors['red']);
$bmpD ata .= pack("c*", $colors['blue'], $colors['green'], $colors['red']);
}
}
$bmp_d ata .= $extra;
$bmpD ata .= $extra;
}
$size_q uad = 0;
$size_data = strlen($bmp_d ata);
$colors_n um = 0;
}
$file_header = 'BM' . pack('V3', 54 + $size_quad + $size_data, 0, 54 + $size_q uad);
$info_header = pack('V3v2V*', 0x28, $width, $height, 1, $bit, $compression, $size_data, 0, 0, $colors_n um, 0);
if ($filen ame != '') {
$fp = fopen($filen ame, 'wb');
fwrite($fp, $file_header . $info_header . $rgb_quad . $bmp_d ata);
$sizeQ uad = 0;
$sizeData = strlen($bmpD ata);
$colorsN um = 0;
}
$fileHeader = 'BM' . pack('V3', 54 + $sizeQuad + $sizeData, 0, 54 + $sizeQ uad);
$infoHeader = pack('V3v2V*', 0x28, $width, $height, 1, $bit, $compression, $sizeData, 0, 0, $colorsN um, 0);
if ($fileN ame != '') {
$fp = fopen($fileN ame, 'wb');
fwrite($fp, $fileHeader . $infoHeader . $rgbQuad . $bmpD ata);
fclose($fp);
return true;
}
echo $file_header . $info_header. $rgb_quad . $bmp_d ata;
echo $fileHeader . $infoHeader. $rgbQuad . $bmpD ata;
return true;
}
}
@ -982,8 +1011,8 @@ if ( ! function_exists( 'exif_imagetype' ) ) {
* @param string $filename
* @return string|boolean
*/
function exif_imagetype ( $filen ame ) {
if ( ( $info = getimagesize( $filen ame ) ) !== false ) {
function exif_imagetype ( $fileN ame ) {
if ( ( $info = getimagesize( $fileN ame ) ) !== false ) {
return $info[2];
}
return false;