Innovative Logistic Ideas Sp. z o. o., ul. Cyfrowa 6, PL - 71-441 Szczecin, Poland
function rpl_vars ($htmlname,$search,$content) {
$search = '<<'.$search.'>>';
$str = str_replace($search, $content, $htmlfile);
return $str;
}
function pdf_page_to_tiff($gs_dir,$source_file,$dest_file,$dpi)
{
//$shellstring = "C:/Programme/gs/gs8.56/bin/gswin32c.exe -sDEVICE=tiff32nc -sOutputFile=c:/www/im/gs_test/test.tif -dBATCH -dNOPAUSE -dSHORTERRORS -dNOPROMPT -dQUIET -q -dFirstPage=1 -dLastPage=1 -r300x300 c:/www/im/gs_test/test.pdf";
$shellstring = "$gs_dir -sDEVICE=tiff32nc -sOutputFile=$dest_file -dBATCH -dNOPAUSE -dSHORTERRORS -dNOPROMPT -dQUIET -q -dFirstPage=1 -dLastPage=1 -r$dpi"."x"."$dpi $source_file";
exec ($shellstring,$gs_return_string);
echo $shellstring;
}
function GetCorrectMTime($filePath)
{
$time = filemtime($filePath);
$isDST = (date('I', $time) == 1);
$systemDST = (date('I') == 1);
$adjustment = 0;
if($isDST == false && $systemDST == true)
$adjustment = 3600;
else if($isDST == true && $systemDST == false)
$adjustment = -3600;
else
$adjustment = 0;
return ($time + $adjustment);
}
/** Reads JPG-file and returns array with 6 elements: type name, image resource, width, height, dpi for x, dpi for y.
* Dpi values might be 0 if file format does not provide dpi or other resolution information.
* Usage:
* list($type, $image, $w, $h, $dpix, $dpiy) = readJpeg($filename);
*/
function readJpeg($filename) {
$type = 'jpeg';
$r = array($type, null, 0, 0, 0, 0);
$image = @imagecreatefromjpeg($filename);
if ($image) {
$w = imagesx($image);
$h = imagesy($image);
$dpix = 0;
$dpiy = 0;
// from: http://php.net/manual/de/function.imagejpeg.php
// soapergem at gmail dot com
// 06-Nov-2008 09:48
$exif = null;
if (function_exists('exif_read_data')) exif_read_data($filename, 'IFD0');
$x = $y = 0;
if (isset($exif['XResolution']) && isset($exif['YResolution'])) {
#$x = intval(preg_replace('@^(\\d+)/(\\d+)$@e', '$1/$2', $exif['XResolution']));
#$y = intval(preg_replace('@^(\\d+)/(\\d+)$@e', '$1/$2', $exif['YResolution']));
$m = array();
if (ereg('^([0-9]+)/([0-9]+)$', $exif['XResolution'], $m)) {
if ($m[2] != 0) {
$x = $m[1] / $m[2];
} else $x = 0;
} else {
$x = floatval($exif['XResolution']);
}
if (ereg('^([0-9]+)/([0-9]+)$', $exif['YResolution'], $m)) {
if ($m[2] != 0) {
$y = $m[1] / $m[2];
} else $y = 0;
} else {
$y = floatval($exif['YResolution']);
}
}
if (!$x && !$y && $fp = fopen($filename, 'r')) {
// from. http://www.fileformat.info/format/jpeg/egff.htm
// last visited 29.3.2010
// typedef struct _JFIFHeader
// {
// BYTE SOI[2]; /* 00h Start of Image Marker */
// BYTE APP0[2]; /* 02h Application Use Marker */
// BYTE Length[2]; /* 04h Length of APP0 Field */
// BYTE Identifier[5]; /* 06h "JFIF" (zero terminated) Id String */
// BYTE Version[2]; /* 07h JFIF Format Revision */
// BYTE Units; /* 09h Units used for Resolution */
// BYTE Xdensity[2]; /* 0Ah Horizontal Resolution */
// BYTE Ydensity[2]; /* 0Ch Vertical Resolution */
// BYTE XThumbnail; /* 0Eh Horizontal Pixel Count */
// BYTE YThumbnail; /* 0Fh Vertical Pixel Count */
// } JFIFHEAD;
// Units, Xdensity, and Ydensity identify the unit of measurement used to describe the image resolution.
// Units may be 01h for dots per inch, 02h for dots per centimeter, or 00h for none (use measurement as
// pixel aspect ratio). Xdensity and Ydensity are the horizontal and vertical resolution of the image
// data, respectively. If the Units field value is 00h, the Xdensity and Ydensity fields will contain
// the pixel aspect ratio (Xdensity : Ydensity) rather than the image resolution. Because non-square
// pixels are discouraged for portability reasons, the Xdensity and Ydensity values normally equal 1
// when the Units value is 0.
$string = fread($fp, 20);
fclose($fp);
$units = hexdec(bin2hex(substr($string, 13, 1)));
$jx = hexdec(bin2hex(substr($string, 14, 2)));
$jy = hexdec(bin2hex(substr($string, 16, 2)));
if ($units == 1) {
// resolution in dots per inch
$x = $jx;
$y = $jy;
} else if ($units == 2) {
$x = $jx * 2.54;
$y = $jy * 2.54;
}
}
if ($x && $y) {
$dpix = $x;
$dpiy = $y;
}
$r = array($type, $image, $w, $h, $dpix, $dpiy);
}
return $r;
}
?>
Warning: Cannot modify header information - headers already sent by (output started at E:\www\il-ideas\functions.php:1) in E:\www\il-ideas\index.php on line 11
Warning: Cannot modify header information - headers already sent by (output started at E:\www\il-ideas\functions.php:1) in E:\www\il-ideas\index.php on line 12
Warning: Cannot modify header information - headers already sent by (output started at E:\www\il-ideas\functions.php:1) in E:\www\il-ideas\index.php on line 13
Warning: Cannot modify header information - headers already sent by (output started at E:\www\il-ideas\functions.php:1) in E:\www\il-ideas\index.php on line 25
Warning: Cannot modify header information - headers already sent by (output started at E:\www\il-ideas\functions.php:1) in E:\www\il-ideas\index.php on line 26
Warning: Cannot modify header information - headers already sent by (output started at E:\www\il-ideas\functions.php:1) in E:\www\il-ideas\index.php on line 27
Innovative Logistic Ideas Sp. z o. o., ul. Cyfrowa 6, PL - 71-441 Szczecin, Poland