<?php
+
/////////////////////////////////////////////////////////////////
/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-// also https://github.com/JamesHeinrich/getID3 //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
+// available at https://github.com/JamesHeinrich/getID3 //
+// or https://www.getid3.org //
+// or http://getid3.sourceforge.net //
+// see readme.txt for more details //
/////////////////////////////////////////////////////////////////
// //
// module.graphic.bmp.php //
public $ExtractPalette = false;
public $ExtractData = false;
+ /**
+ * @return bool
+ */
public function Analyze() {
$info = &$this->getid3->info;
// high- and low-order 4 bits, one color index for each pixel. In absolute mode,
// each run must be aligned on a word boundary.
unset($paletteindexes);
+ $paletteindexes = array();
for ($i = 0; $i < ceil($secondbyte / 2); $i++) {
$paletteindexbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1));
$paletteindexes[] = ($paletteindexbyte & 0xF0) >> 4;
return true;
}
-
+ /**
+ * @param array $BMPinfo
+ *
+ * @return bool
+ */
public function PlotBMP(&$BMPinfo) {
$starttime = time();
if (!isset($BMPinfo['bmp']['data']) || !is_array($BMPinfo['bmp']['data'])) {
return false;
}
set_time_limit(intval(round($BMPinfo['resolution_x'] * $BMPinfo['resolution_y'] / 10000)));
- if ($im = ImageCreateTrueColor($BMPinfo['resolution_x'], $BMPinfo['resolution_y'])) {
+ if ($im = imagecreatetruecolor($BMPinfo['resolution_x'], $BMPinfo['resolution_y'])) {
for ($row = 0; $row < $BMPinfo['resolution_y']; $row++) {
for ($col = 0; $col < $BMPinfo['resolution_x']; $col++) {
if (isset($BMPinfo['bmp']['data'][$row][$col])) {
$red = ($BMPinfo['bmp']['data'][$row][$col] & 0x00FF0000) >> 16;
$green = ($BMPinfo['bmp']['data'][$row][$col] & 0x0000FF00) >> 8;
$blue = ($BMPinfo['bmp']['data'][$row][$col] & 0x000000FF);
- $pixelcolor = ImageColorAllocate($im, $red, $green, $blue);
- ImageSetPixel($im, $col, $row, $pixelcolor);
+ $pixelcolor = imagecolorallocate($im, $red, $green, $blue);
+ imagesetpixel($im, $col, $row, $pixelcolor);
} else {
//echo 'ERROR: no data for pixel '.$row.' x '.$col.'<BR>';
//return false;
}
if (headers_sent()) {
echo 'plotted '.($BMPinfo['resolution_x'] * $BMPinfo['resolution_y']).' pixels in '.(time() - $starttime).' seconds<BR>';
- ImageDestroy($im);
+ imagedestroy($im);
exit;
} else {
header('Content-type: image/png');
- ImagePNG($im);
- ImageDestroy($im);
+ imagepng($im);
+ imagedestroy($im);
return true;
}
}
return false;
}
+ /**
+ * @param int $compressionid
+ *
+ * @return string
+ */
public function BMPcompressionWindowsLookup($compressionid) {
static $BMPcompressionWindowsLookup = array(
0 => 'BI_RGB',
return (isset($BMPcompressionWindowsLookup[$compressionid]) ? $BMPcompressionWindowsLookup[$compressionid] : 'invalid');
}
+ /**
+ * @param int $compressionid
+ *
+ * @return string
+ */
public function BMPcompressionOS2Lookup($compressionid) {
static $BMPcompressionOS2Lookup = array(
0 => 'BI_RGB',