[erl] Smartors Photo Album: Anzeigen der EXIF Daten

Du hast Probleme beim Einbau oder bei der Benutzung eines Mods? In diesem Forum bist du richtig.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
Benutzeravatar
Dungeonwatcher
Mitglied
Beiträge: 635
Registriert: 11.07.2004 10:04
Wohnort: Berlin

[erl] Smartors Photo Album: Anzeigen der EXIF Daten

Beitrag von Dungeonwatcher »

Moin! 8)

Basierend auf einen verschollenen Mini Mod vom Programmierer des Photo Albums Smartor und Pgh-Biker habe ich die Anzeige der Exif Daten von Bildern etwas angepasst.

Suche in der album_page.php:

Code: Alles auswählen

//
// Generate the page
//
davor füge ein:

Code: Alles auswählen

$xif = @exif_read_data(ALBUM_UPLOAD_PATH . $thispic['pic_filename'], 0, true);
if (!empty($xif[IFD0]) || !empty($xif[EXIF]))
{
	include_once($phpbb_root_path . 'exif_info.'.$phpEx);
}
suche in der templates/subSilver/album_page_body.tpl:

Code: Alles auswählen

        </tr>
        <!-- END comment_switch -->
      </table>
    </td>
ersetze es durch:

Code: Alles auswählen

        </tr>
        <!-- END comment_switch -->
      </table>
	  <br />
      <!-- BEGIN exif_switch -->
      <table width="99%" align="center" border="0" cellpadding="3" cellspacing="1" class="forumline">
        <tr>
          <td align="center" colspan="4"><span class="gen"><b>Image EXIF Informationen</b></span></td>
        </tr>
        <!-- BEGIN exif_data -->
        <tr>
          <td class="row1" width="20%" align="right"><span class="explaintitle">{exif_switch.exif_data.EXIFc1}</span></td>
          <td class="row1" width="30%" ><b><span class="genmed">{exif_switch.exif_data.EXIFd1}</span></b></td>
          <td class="row1" width="20%" align="right"><span class="explaintitle">{exif_switch.exif_data.EXIFc2}</span></td>
          <td class="row1" width="30%" ><b><span class="genmed">{exif_switch.exif_data.EXIFd2}</span></b></td>
        </tr>
        <!-- END exif_data -->
      </table>
      <!-- END exif_switch -->
    </td>
Dann erstelle eine Datei exif_info.php:

Code: Alles auswählen

<?php
/***************************************************************************
 *							exif_info.php
 *							---------------
 *	begin				: 03/18/2005 | 05/30/2009
 *	copyright			: Pgh-Biker | Dungeonwatcher
 *	email				: 
 *
 *	version			: 1.0.1
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = './';
global $board_config;
function make_exif($xkey, $xval)
{
	global $board_config;
	$exif_info = array(
		'FILE_FileDateTime'	=> 'Original Datum/Uhrzeit ',
		'FILE_FileSize'		=> array(
			'Name'	=> 'Dateigr&ouml;&szlig;e',
			'Units'	=> ' bytes'
			),
		'COMPUTED_Height' => array(
			'Name'	=> 'Bild H&ouml;he',
			'Units'	=> ' Pixel'
			),
		'COMPUTED_Width' => array(
			'Name'	=> 'Bild Breite',
			'Units'	=> ' Pixel'
			),
		'COMPUTED_ApertureFNumber'	=> 'Blende',
		'COMPUTED_UserComment'		=> 'User Kommentar',
		'IFD0_ImageDescription'		=> 'Bildbeschreibung',
		'IFD0_Make'					=> 'Kamera (Hersteller)',
		'IFD0_Model'				=> 'Kamera Model',
		'IFD0_XResolution'			=> array(
			'Name'	=> 'Horizontale Aufl&ouml;sung',
			'Units'	=> ' Pixel per'
			),
		'IFD0_YResolution'	=> array(
			'Name'	=> 'Vertikale Aufl&ouml;sung',
			'Units'	=> ' Pixel per'
			),
		'IFD0_ResolutionUnit'	=> array(
			'Name'	=> 'Ma&szlig;einheit der Aufl&ouml;sung',
			'2'		=> ' Inch',
			'3'		=> ' Zentimeter'
			),
		'IFD0_Software'		=> 'Firmware / Erstellungssoftware',
		'IFD0_Artist'		=> 'Autor',
		'IFD0_Copyright'	=> 'Copyright',
		'EXIF_ExposureTime'	=> array(
			'Name'	=> 'Belichtungszeit',
			'Units'	=> ' Sekunde(n)'
			),
		'EXIF_ExposureProgram'		=> array(
			'Name'	=> 'Belichtungsprogramm',
			'0'		=> 'Nicht angegeben',
			'1'		=> 'Manuell',
			'2'		=> 'Normal',
			'3'		=> 'optimiert nach Blende',
			'4'		=> 'optimiert nach Belichtungszeit',
			'5'		=> 'Kreatives Programm (bevorzugt Sch&auml;rfentiefe)',
			'6'		=> 'Kreatives Programm (bevorzugt kurze Belichtungszeit)',
			'7'		=> 'Portrait Modus (f&uuml;r Nahaufnahmen mit unscharfem Hintergrund)',
			'8'		=> 'Landschafts Modus (f&uuml;r Landschaftsaufnahmen mit scharfem Hintergrund)'
			),
		'EXIF_ISOSpeedRatings'		=> 'ISO Wert',
		'EXIF_DateTimeOriginal'		=> 'Digitalisierung Datum/Uhrzeit ',
//		'EXIF_DateTimeDigitized'	=> 'Date and Time when Digitized',
		'EXIF_ExposureBiasValue'	=> array(
			'Name'	=> 'Wert der Belichtungsabweichung ',
			'Units'	=> 'EV'
			),
		'EXIF_MaxApertureValue'	=> 'APEX Maximale Blendöffnung',
		'EXIF_MeteringMode'	=> array(
			'Name'	=> 'Belichtungsmessverfahren',
			'0'		=> 'Unbekannt',
			'1'		=> 'Durchschnitt',
			'2'		=> 'Mittenbetonter Durchschnitt',
			'3'		=> 'Punkt',
			'4'		=> 'Mehr-Punkt',
			'5'		=> 'Raster',
			'6'		=> 'Partiell',
			'255'	=> 'Anderes'
			),
		'EXIF_LightSource' => array(
			'Name'	=> 'Licht Quelle',
			'0'		=> 'Unbekannt',
			'1'		=> 'Tageslicht',
			'2'		=> 'Leuchstoffr&ouml;hre',
			'3'		=> 'Wolframlicht',
			'4'		=> 'Blitz',
			'9'		=> 'Sch&ouml;nes Wetter',
			'10'	=> 'Wolkiges Wetter',
			'11'	=> 'Schatten',
			'12'	=> 'Tageslicht Leuchtstoffr&ouml;hre (D 5700 – 7100K)',
			'13'	=> 'Tageslichtwei&szlig; Leuchtstoffr&ouml;hre (N 4600 – 5400K)',
			'14'	=> 'K&uuml;hle wei&szlig;e Leuchtstoffr&ouml;re (W 3900 – 4500K)',
			'15'	=> 'Wei&szlig;es Leuchtstofflicht (WW 3200 – 3700K)',
			'17'	=> 'Standard Licht A',
			'18'	=> 'Standard Licht B',
			'19'	=> 'Standard Licht C',
			'20'	=> 'D55',
			'21'	=> 'D65',
			'22'	=> 'D75',
			'23'	=> 'D50',
			'24'	=> 'ISO Studio Wolfram',
			'255'	=> 'Anderes'
			),
		'EXIF_Flash'	=> array(
			'Name'	=> 'Blitz Modus',
			'0'		=> 'Blitz wurde nicht ausgel&ouml;st',
			'1'		=> 'Blitz wurde ausgel&ouml;st',
			'5'		=> 'Kein Messblitz-Licht zurückgeworfen',
			'7'		=> 'Messblitz-Licht zur&uuml;ckgeworfen',
			'8'		=> 'Ein, Blitz wurde nicht ausgel&ouml;st',
			'9'		=> 'Blitz wurde ausgel&ouml;st, Blitz erzwingen-Modus',
			'13'	=> 'Blitz wurde ausgel&ouml;st, Blitz erzwingen-Modus, kein Messblitz-Licht zur&uuml;ckgeworfen',
			'15'	=> 'Blitz wurde ausgel&ouml;st, Blitz erzwingen-Modus, Messblitz-Licht zur&uuml;ckgeworfen',
			'16'	=> 'Blitz wurde nicht ausgel&ouml;st, Blitz unterdr&uuml;cken-Modus',
			'20'	=> 'Deaktiviert, Blitz wurde nicht ausgel&ouml;st, kein Messblitz-Licht zur&uuml;ckgeworfen',
			'24'	=> 'Blitz wurde nicht ausgel&ouml;st, Automodus',
			'25'	=> 'Blitz wurde ausgel&ouml;st, Automodus',
			'29'	=> 'Blitz wurde ausgel&ouml;st, Automodus, kein Messblitz-Licht zur&uuml;ckgeworfen',
			'31'	=> 'Blitz wurde ausgel&ouml;st, Automodus, Messblitz-Licht zur&uuml;ckgeworfen',
			'32'	=> 'Keine Blitzfunktion',
			'48'	=> 'Deaktiviert, Keine Blitzfunktion',
			'65'	=> 'Blitz wurde ausgel&ouml;st, Rote-Augen-Reduzierung',
			'69'	=> 'Blitz wurde ausgel&ouml;st, Rote-Augen-Reduzierung, kein Messblitz-Licht zur&uuml;ckgeworfen',
			'71'	=> 'Blitz wurde ausgel&ouml;st, Rote-Augen-Reduzierung, Messblitz-Licht zur&uuml;ckgeworfen',
			'73'	=> 'Blitz wurde ausgel&ouml;st, Blitz erzwingen-Modus, Rote-Augen-Reduzierung',
			'77'	=> 'Blitz wurde ausgel&ouml;st, Blitz erzwingen-Modus, Rote-Augen-Reduzierung, kein Messblitz-Licht zur&uuml;ckgeworfen',
			'79'	=> 'Blitz wurde ausgel&ouml;st, Blitz erzwingen-Modus, Rote-Augen-Reduzierung, Messblitz-Licht zur&uuml;ckgeworfen',
			'80'	=> 'Deaktiviert, Rote-Augen-Reduzierung',
			'88'	=> 'Blitz wurde nicht ausgel&ouml;st, Rote-Augen-Reduzierung',
			'89'	=> 'Blitz wurde ausgel&ouml;st, Automodus, Rote-Augen-Reduzierung',
			'93'	=> 'Blitz wurde ausgel&ouml;st, Automodus, kein Messblitz-Licht zur&uuml;ckgeworfen, Rote-Augen-Reduzierung',
			'95'	=> 'Blitz wurde ausgel&ouml;st, Automodus, Messblitz-Licht zur&uuml;ckgeworfen, Rote-Augen-Reduzierung'
			),
		'EXIF_FocalLength' => array(
			'Name'	=> 'Fokusl&auml;nge',
			'Units'	=> ' mm'
			),
		'EXIF_ShutterSpeedValue' => array(
			'Name'	=> 'Belichtungszeitwert',
			'Units'	=> ' sek.'
			),
		'EXIF_SensingMethod' => array(
			'Name'	=> 'Bildsensor',
			'1'		=> 'Unbekannt',
			'2'		=> 'Einzel Chip Farbsensor',
			'3'		=> 'Zwei Chip Farbsensor',
			'4'		=> 'Drei Chip Farbsensor',
			'5'		=> 'Farbraum sequentieller Sensor',
			'7'		=> 'Trilinearer Sensor',
			'8'		=> 'Farbraum linear sequentieller Sensor'
			),
		'EXIF_CustomRendered' => array(
			'Name'	=> 'Individuelle Wiedergabe',
			'0'		=> 'Normal',
			'1'		=> 'Anwender',
			),
		'EXIF_ExposureMode' => array(
			'Name'	=> 'Belichtungssteuerung',
			'0'		=> 'Auto Modus',
			'1'		=> 'Manuell',
			'2'		=> 'Automatische Erfassung'
			),
		'EXIF_WhiteBalance' => array(
			'Name'	=> 'Wei&szlig;abgleich',
			'0'		=> 'Auto Modus',
			'1'		=> 'Manuell'
			),
		'EXIF_Compression' => array(
			'Name'	=> 'Kompressionsart',
			'1'		=> 'Tiff',
			'3'		=> 'nicht komprimiert',
			'6'		=> 'Jpeg',
			),
		'EXIF_DigitalZoomRatio' => array(
			'Name'	=> 'Digitalzoomverhältnis',
			'Units'	=> ' ( Zero = Digital Zoom Not Used )'
			),
		'EXIF_FocalLengthIn35mmFilm' => array(
			'Name'	=> 'Equivalent Focal Length In 35mm Film',
			'Units'	=> ' mm'
			),
		'EXIF_SceneCaptureType' => array(
			'Name'	=> 'Motivprogramm',
			'0'		=> "Standard",
			'1'		=> "Landschaft",
			'2'		=> "Portrait",
			'3'		=> "Nacht"
			),
		'EXIF_GainControl' => array(
			'Name'	=> 'Gain Control',
			'0'		=> 'None',
			'1'		=> 'Low gain up',
			'2'		=> 'High gain up',
			'3'		=> 'Low gain down',
			'4'		=> 'High gain down'
			),
		'EXIF_Contrast' => array(
			'Name'	=> 'Kontrast',
			'0'		=> 'Normal',
			'1'		=> 'Weich',
			'2'		=> 'Hart'
			),
		'EXIF_Saturation' => array(
			'Name'	=> 'S&auml;ttigung',
			'0'		=> 'Normal',
			'1'		=> 'gering',
			'2'		=> 'Hoch'
			),
		'EXIF_Sharpness' => array(
			'Name'	=> 'Sch&auml;rfe',
			'0'		=> 'Normal',
			'1'		=> 'Soft',
			'2'		=> 'Hard'
			),
		'EXIF_SubjectDistanceRange' => array(
			'Name'	=> 'Objektiv Entferungsbereich',
			'0'		=> 'Unbekannt',
			'1'		=> 'Makro',
			'2'		=> 'Nahaufnahme',
			'3'		=> 'Gro&szlig;e Entfernung'
			),
		'EXIF_ColorSpace' => array(
			'Name'	=> 'Farbraum',
			'0'		=> 'sBW',
			'1'		=> 'sRGB',
			'65535'	=> 'unbekannt'
			),
	);

	$i = 0;
	$rexif = array();

	while (!empty($xkey[$i]) )
	{
		if ( ereg("([0-9]{1,})/([0-9]{1,})", $xval[$i], $num) )
		{
			if ( $num[1] > 1 ) $xval[$i] = round( ($num[1] / $num[2]), 6);
		}
		if ( is_array($exif_info[$xkey[$i]]) && $xkey[$i] != 'IFD0_ResolutionUnit' )
		{
			if ( isset($exif_info[$xkey[$i]]['Units']) )
			{
				if ( $xkey[$i+2] == 'IFD0_ResolutionUnit' )
				{
					$rexif[$exif_info[$xkey[$i]]['Name']] = ($xval[$i] . $exif_info[$xkey[$i]]['Units'] . $exif_info[$xkey[$i+2]][$xval[$i+2]]);
				}
				else if ( $xkey[$i+1] == 'IFD0_ResolutionUnit' )
				{
					$rexif[$exif_info[$xkey[$i]]['Name']] = ($xval[$i] . $exif_info[$xkey[$i]]['Units'] . $exif_info[$xkey[$i+1]][$xval[$i+1]]);
				}
				else
				{
					$rexif[$exif_info[$xkey[$i]]['Name']] = ($xval[$i] . $exif_info[$xkey[$i]]['Units']);
				}
			}
			else
			{
				$rexif[$exif_info[$xkey[$i]]['Name']] = $exif_info[$xkey[$i]][$xval[$i]];
			}
		}
		else if ( isset($exif_info[$xkey[$i]]) && $xkey[$i] != 'IFD0_ResolutionUnit' )
		{
			$rexif[$exif_info[$xkey[$i]]] = $xval[$i];
			if ( $xkey[$i] == 'FILE_FileDateTime' )
			{
				$rexif[$exif_info[$xkey[$i]]] = create_date('Y:m:d H:i:s',  $xval[$i], $board_config['board_timezone']);
			}
		}
		$i++;
	}
	return $rexif;
}

$template->assign_block_vars('exif_switch', array());
$i = 0;
$xkey = array();
$xval = array();

while (list($xk1,$xv1) = each($xif))
{
	$xkey[$i] = $xk1;
	$xval[$i] = $xv1;
	if (is_array($xif[$xk1]))
	{
		while (list($xk2,$xv2) = each($xif[$xk1]))
		{
			$xkey[$i] = $xk1.'_'.$xk2;
			$xval[$i] = $xv2;
			$i++;
		}
	}
	else
	{
		$i++;
	}
}

$exif = make_exif($xkey, $xval);
$i = 0;
$key = array();
$val = array();

while (list($k1,$v1) = each($exif))
{
	$key[$i] = $k1;
	$val[$i] = $v1;
	$i++;
}

$x = intval(($i/2)+.5);

for ($n = 0; $n < $x; $n++)
{
	$template->assign_block_vars('exif_switch.exif_data', array(
		'EXIFc1'	=> (!empty($key[$n])) ? $key[$n].':' : '',
		'EXIFd1'	=> ''.$val[$n],
		'EXIFc2'	=> (!empty($key[$n+$x])) ? $key[$n+$x].':' : '',
		'EXIFd2'	=> ''.$val[$n+$x]
	));
}

?>
Diese kopiere in das Root Verzeichniss des Forums.

Das war's. Nun werden bei der Anzeige der Bilder die vorhandenen Exif Daten angezeigt.

Bye
Antworten

Zurück zu „phpBB 2.0: Mod Support“