Page 2 of 5

Re: NV Exif Data

Posted: Sun Aug 10, 2008 11:26 am
by Wookie1664
In the install.xml part of it says in functions_content.php find

Code: Select all

 
$download_link .= '&mode=view';
Then add some code after it.

Just checking through my install and

$download_link .= '&mode=view';

Is in functions_content.php twice. I added after the first one, should it have been the second or both? Or is the bug nothing to do with this.

Regards

Wookie

Re: NV Exif Data

Posted: Sun Aug 10, 2008 1:04 pm
by nickvergessen
Wookie1664 wrote:In the install.xml part of it says in functions_content.php find

Code: Select all

 
$download_link .= '&mode=view';
Then add some code after it.

Just checking through my install and

$download_link .= '&mode=view';

Is in functions_content.php twice. I added after the first one, should it have been the second or both? Or is the bug nothing to do with this.

Regards

Wookie
uh, that might be the reason why GoBieN doesn't see anything of this MOD.

Wookie: did you test with the file, provided on the first page in this topic?

Re: NV Exif Data

Posted: Sun Aug 10, 2008 2:04 pm
by Wookie1664
Not yet I haven't..will do in just a few mins..

[edit] Yes actually that change was made (thought I may have missed something when I said I had not) and time photo was taken is working fine. Changed it to this.

Code: Select all

$exif_date = $user->format_date($timestamp);
Wookie

Re: NV Exif Data

Posted: Sun Aug 10, 2008 6:35 pm
by GoBieN
I added the php code of the mod after the second FIND :
$download_link .= '&mode=view';
So i now have the PHP part 2 times in includes/functions_content.php
Purged general cache, refreshed template ... still nothing.
I added the echo "someting" right below the 1st line (the IF line), like this:
if (!empty($exif["EXIF"]))
{
echo "something";
When i reloaded the page i got these PHP errors, so i believe the code block is actually being executed.
somethingsomething[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3616: Cannot modify header information - headers already sent by (output started at /includes/functions_content.php:993)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3618: Cannot modify header information - headers already sent by (output started at /includes/functions_content.php:993)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3619: Cannot modify header information - headers already sent by (output started at /includes/functions_content.php:993)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3620: Cannot modify header information - headers already sent by (output started at /includes/functions_content.php:993)
I hope this is what you needed to see ?

Re: NV Exif Data

Posted: Sun Aug 10, 2008 6:45 pm
by GoBieN
Found the problem, it's in the template.
Your EXIF code is only included after the <!-- IF _file.S_IMAGE --> block.
But i have thumbnails, so the <!-- IF _file.S_THUMBNAIL --> block is executed, and not the above.

I added the code after the thumbnail block and now i see the EXIF information.
But the styling is off and ugly.

Re: NV Exif Data

Posted: Sun Aug 10, 2008 6:58 pm
by nickvergessen
try the style of subsilver2.

good to know, i'll edit the manual so you edit both parts.

Re: NV Exif Data

Posted: Sun Aug 10, 2008 10:44 pm
by updown
Wookie1664 wrote:Found a small bug, when a .png file was attached to a post I got the following error

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/functions_content.php on line 927: exif_read_data(58_3edd3e8ef5ee9a500b2dc2b4da4682db) [function.exif-read-data]: File not supported
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3596: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3002)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3598: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3002)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3599: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3002)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3600: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3002)
Then this when a .gif was attached to a post.

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/functions_content.php on line 927: exif_read_data(2_29e538faefdc3b51960903bdb81991a5) [function.exif-read-data]: File not supported
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3596: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3002)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3598: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3002)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3599: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3002)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3600: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3002)
If it helps, line 926-931 of functions_content.php

Code: Select all

					$download_link .= '&mode=view';
					$exif = exif_read_data($filename, 0, true);
					if (!empty($exif["EXIF"]))
					{
Wookie


I have the same issues on GIFs and PNGs - just JPG working fine :!:

Is there a possibility to to check first if it is a jpeg file, or an other solution to this :?:

Re: NV Exif Data

Posted: Sun Aug 10, 2008 11:06 pm
by updown
In functions_content.php, I changed the edit-line:

Code: Select all

$exif = exif_read_data($filename, 0, true);
to

Code: Select all

                    if ($attachment['extension'] == 'jpg' || $attachment['extension'] == 'jpeg'))
                    {
                        @$exif = exif_read_data($filename, 0, true);
                    } 
for
1.) doing the exif-thing just for jpg-files

and adding the '@' before '$exif = exif_read_data($filename, 0, true);' for

2.) stopping debug-notices if attached-files are not on the server anymore ;)

AND: I think it it necessary to do the edits for both IMAGES and THUMBS in function and template :!:

For me this works - perhaps there is a more elegant solution, I'm open-minded for suggestions. And thanks nickvergessen - good job!! :idea:

Re: NV Exif Data

Posted: Mon Aug 11, 2008 10:37 am
by Dr.Death
Good idea,

but there is a ' ) ' too much ;-)

This should give no parse error:

Code: Select all

if ($attachment['extension'] == 'jpg' || $attachment['extension'] == 'jpeg')

Re: NV Exif Data

Posted: Mon Aug 11, 2008 2:22 pm
by updown
Thanks, this has been a copy-paste-forums-entry-failure :D

There has been an other bug emerged on a specific picture, seems that the EXIF-data for the timestamp of that special picture in not code-conform:

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/functions_content.php on line 940: mktime() expects parameter 1 to be long, string given

Code: Select all

if(isset($exif["EXIF"]["DateTimeOriginal"]))
{
$timestamp = mktime(substr($exif["EXIF"]["DateTimeOriginal"], 11, 2), substr($exif["EXIF"]["DateTimeOriginal"], 14, 2), substr($exif["EXIF"]["DateTimeOriginal"], 17, 2), substr($exif["EXIF"]["DateTimeOriginal"], 5, 2), substr($exif["EXIF"]["DateTimeOriginal"], 8, 2), substr($exif["EXIF"]["DateTimeOriginal"], 0, 4));
$exif_date = $user->format_date($timestamp);
} 
I made an '@'-"solution" again before $timestamp :roll:

:?: :?:

Re: NV Exif Data

Posted: Mon Aug 11, 2008 4:35 pm
by nickvergessen
updown wrote:I made an '@'-"solution" again before $timestamp :roll:
I'll change it.
but, what's your limit about mktime? It works fine for me!

Re: NV Exif Data

Posted: Mon Aug 11, 2008 6:20 pm
by GoBieN
nickvergessen wrote:try the style of subsilver2.

good to know, i'll edit the manual so you edit both parts.
I don't have subsilver2 installed at my board.
I will await your updated version that included info for thumbnails with good styling.

Re: NV Exif Data

Posted: Mon Aug 11, 2008 6:30 pm
by nickvergessen
GoBieN wrote:I don't have subsilver2 installed at my board.
I wanted to say, that you should try to do the edits for subsilver2 on your template instead of prosilver

Re: NV Exif Data

Posted: Mon Aug 11, 2008 6:55 pm
by GoBieN
I went for the show/hide DIV approach.
See it in action here:
http://www.camino-tuning.be/opmerkingen ... 23687.html

Click show/hide to display or hide the EXIF data below the thumbnail.
code:
includes/functions_content.php
FIND: (2 times)

Code: Select all

'S_EXIF_DATA'	=> true,
AFTER ADD:

Code: Select all

'EXIF_IMAGE_ID' => $attachment['attach_id'],
attachment.html (full source)

Code: Select all


<!-- BEGIN _file -->
	<!-- IF _file.S_DENIED -->
	<p>[{_file.DENIED_MESSAGE}]</p>
	<!-- ELSE -->

		<!-- IF _file.S_THUMBNAIL -->
		<dl class="thumbnail">
			<dt><a href="{_file.U_DOWNLOAD_LINK}"><img src="{_file.THUMB_IMAGE}" alt="{_file.DOWNLOAD_NAME}" title="{_file.DOWNLOAD_NAME} ({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}" /></a></dt>
			<!-- IF _file.COMMENT --><dd> {_file.COMMENT}</dd><!-- ENDIF -->
			<!-- IF _file.S_EXIF_DATA -->
			<strong>{L_EXIF-DATA}</strong> (<a href="javascript:showhide('hideshow{_file.EXIF_IMAGE_ID}')">show/hide</a>)
			<div id="hideshow{_file.EXIF_IMAGE_ID}" style="font-size: 0.8em; display: none;">
				{L_EXIF_DATE}: <em>{_file.EXIF_DATE}</em><br />
				{L_EXIF_FOCAL}: <em>{_file.EXIF_FOCAL} {L_EXIF_FOCAL_EXP}</em><br />
				{L_EXIF_EXPOSURE}: <em>{_file.EXIF_EXPOSURE} {L_EXIF_EXPOSURE_EXP}</em><br />
				{L_EXIF_APERTURE}: <em>{_file.EXIF_APERTURE}</em><br />
				{L_EXIF_ISO}: <em>{_file.EXIF_ISO}</em><br />
				{L_EXIF_FLASH}: <em>{_file.EXIF_FLASH}</em><br />
				{L_EXIF_WHITEB}: <em>{_file.WHITEB}</em><br />
				{L_EXIF_CAM_MODEL}: <em>{_file.CAM_MODEL}</em><br />
			</div>
			<!-- ENDIF -->			
		</dl>
		<!-- ENDIF -->


		<!-- IF _file.S_IMAGE -->
		<dl class="file">
			<dt class="attach-image"><img src="{_file.U_INLINE_LINK}" alt="{_file.DOWNLOAD_NAME}" onclick="viewableArea(this);" /></dt>
			<!-- IF _file.COMMENT --><dd><em>{_file.COMMENT}</em></dd><!-- ENDIF -->
			<dd>{_file.DOWNLOAD_NAME} ({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}</dd>
			<!-- IF _file.S_EXIF_DATA -->
			<strong>{L_EXIF-DATA}</strong> (<a href="javascript:showhide('hideshow{_file.EXIF_IMAGE_ID}')">show/hide</a>)
			<div id="hideshow{_file.EXIF_IMAGE_ID}" style="font-size: 0.8em; display: none;">
				{L_EXIF_DATE}: <em>{_file.EXIF_DATE}</em><br />
				{L_EXIF_FOCAL}: <em>{_file.EXIF_FOCAL} {L_EXIF_FOCAL_EXP}</em><br />
				{L_EXIF_EXPOSURE}: <em>{_file.EXIF_EXPOSURE} {L_EXIF_EXPOSURE_EXP}</em><br />
				{L_EXIF_APERTURE}: <em>{_file.EXIF_APERTURE}</em><br />
				{L_EXIF_ISO}: <em>{_file.EXIF_ISO}</em><br />
				{L_EXIF_FLASH}: <em>{_file.EXIF_FLASH}</em><br />
				{L_EXIF_WHITEB}: <em>{_file.WHITEB}</em><br />
				{L_EXIF_CAM_MODEL}: <em>{_file.CAM_MODEL}</em><br />
			</div>
			<!-- ENDIF -->
		</dl>
		<!-- ENDIF -->

		<!-- IF _file.S_FILE -->
		<dl class="file">
			<dt><!-- IF _file.UPLOAD_ICON -->{_file.UPLOAD_ICON} <!-- ENDIF --><a class="postlink" href="{_file.U_DOWNLOAD_LINK}">{_file.DOWNLOAD_NAME}</a></dt>
			<!-- IF _file.COMMENT --><dd><em>{_file.COMMENT}</em></dd><!-- ENDIF -->
			<dd>({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}</dd>
		</dl>
		<!-- ENDIF -->



		<!-- IF _file.S_WM_FILE -->
			<!-- method used here from http://alistapart.com/articles/byebyeembed / autosizing seems to not work always, this will not fix -->
			<object width="320" height="285" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" id="wmstream_{_file.ATTACH_ID}">
				<param name="url" value="{_file.U_DOWNLOAD_LINK}" />
				<param name="showcontrols" value="1" />
				<param name="showdisplay" value="0" />
				<param name="showstatusbar" value="0" />
				<param name="autosize" value="1" />
				<param name="autostart" value="0" />
				<param name="visible" value="1" />
				<param name="animationstart" value="0" />
				<param name="loop" value="0" />
				<param name="src" value="{_file.U_DOWNLOAD_LINK}" />
				<!--[if !IE]>-->
					<object width="320" height="285" type="video/x-ms-wmv" data="{_file.U_DOWNLOAD_LINK}">
						<param name="src" value="{_file.U_DOWNLOAD_LINK}" />
						<param name="controller" value="1" />
						<param name="showcontrols" value="1" />
						<param name="showdisplay" value="0" />
						<param name="showstatusbar" value="0" />
						<param name="autosize" value="1" />
						<param name="autostart" value="0" />
						<param name="visible" value="1" />
						<param name="animationstart" value="0" />
						<param name="loop" value="0" />
					</object>
				<!--<![endif]-->
			</object>

		<!-- ELSEIF _file.S_FLASH_FILE -->
			<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="{_file.WIDTH}" height="{_file.HEIGHT}">
				<param name="movie" value="{_file.U_DOWNLOAD_LINK}" />
				<param name="play" value="true" />
				<param name="loop" value="true" />
				<param name="quality" value="high" />
				<param name="allowScriptAccess" value="never" />
				<param name="allowNetworking" value="internal" />
				<embed src="{_file.U_DOWNLOAD_LINK}" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="{_file.WIDTH}" height="{_file.HEIGHT}" play="true" loop="true" quality="high" allowscriptaccess="never" allownetworking="internal"></embed>
			</object>
		<!-- ELSEIF _file.S_QUICKTIME_FILE -->
			<object id="qtstream_{_file.ATTACH_ID}" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="0" height="16">
				<param name="src" value="{_file.U_DOWNLOAD_LINK}" />
				<param name="controller" value="true" />
				<param name="autoplay" value="false" />
				<param name="type" value="video/quicktime" />
				<embed name="qtstream_{_file.ATTACH_ID}" src="{_file.U_DOWNLOAD_LINK}" pluginspage="http://www.apple.com/quicktime/download/" enablejavascript="true" controller="true" width="0" height="16" type="video/quicktime" autoplay="false"></embed>
			</object>
		<!-- ELSEIF _file.S_RM_FILE -->
			<object id="rmstream_{_file.ATTACH_ID}" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="200" height="50">
				<param name="src" value="{_file.U_DOWNLOAD_LINK}" />
				<param name="autostart" value="false" />
				<param name="controls" value="ImageWindow" />
				<param name="console" value="ctrls_{_file.ATTACH_ID}" />
				<param name="prefetch" value="false" />
				<embed name="rmstream_{_file.ATTACH_ID}" type="audio/x-pn-realaudio-plugin" src="{_file.U_DOWNLOAD_LINK}" width="0" height="0" autostart="false" controls="ImageWindow" console="ctrls_{_file.ATTACH_ID}" prefetch="false"></embed>
			</object>
			<br />
			<object id="ctrls_{_file.ATTACH_ID}" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="0" height="36">
				<param name="controls" value="ControlPanel" />
				<param name="console" value="ctrls_{_file.ATTACH_ID}" />
				<embed name="ctrls_{_file.ATTACH_ID}" type="audio/x-pn-realaudio-plugin" width="200" height="36" controls="ControlPanel" console="ctrls_{_file.ATTACH_ID}"></embed>
			</object>

			<script type="text/javascript">
			// <![CDATA[
				if (document.rmstream_{_file.ATTACH_ID}.GetClipWidth)
				{
					while (!document.rmstream_{_file.ATTACH_ID}.GetClipWidth())
					{
					}

					var width = document.rmstream_{_file.ATTACH_ID}.GetClipWidth();
					var height = document.rmstream_{_file.ATTACH_ID}.GetClipHeight();

					document.rmstream_{_file.ATTACH_ID}.width = width;
					document.rmstream_{_file.ATTACH_ID}.height = height;
					document.ctrls_{_file.ATTACH_ID}.width = width;
				}
			// ]]>
			</script>
		<!-- ENDIF -->

		<!-- IF _file.S_WM_FILE or _file.S_RM_FILE or _file.S_FLASH_FILE or _file.S_QUICKTIME_FILE -->
			<p>
			<!-- IF _file.S_QUICKTIME_FILE --><a href="#" onclick="play_qt_file(document.qtstream_{_file.ATTACH_ID}); return false;">[ {L_PLAY_QUICKTIME_FILE} ]</a> <!-- ENDIF -->
			<a href="{_file.U_DOWNLOAD_LINK}">{_file.DOWNLOAD_NAME}</a> [ {_file.FILESIZE} {_file.SIZE_LANG} | {_file.L_DOWNLOAD_COUNT} ]</p>
		<!-- ENDIF -->

	<!-- ENDIF -->
<!-- END _file -->
It comes down to this for the EXIF part inside the atatchment.html template:

Code: Select all

<strong>{L_EXIF-DATA}</strong> (<a href="javascript:showhide('hideshow{_file.EXIF_IMAGE_ID}')">show/hide</a>)
			<div id="hideshow{_file.EXIF_IMAGE_ID}" style="font-size: 0.8em; display: none;">
				{L_EXIF_DATE}: <em>{_file.EXIF_DATE}</em><br />
				{L_EXIF_FOCAL}: <em>{_file.EXIF_FOCAL} {L_EXIF_FOCAL_EXP}</em><br />
				{L_EXIF_EXPOSURE}: <em>{_file.EXIF_EXPOSURE} {L_EXIF_EXPOSURE_EXP}</em><br />
				{L_EXIF_APERTURE}: <em>{_file.EXIF_APERTURE}</em><br />
				{L_EXIF_ISO}: <em>{_file.EXIF_ISO}</em><br />
				{L_EXIF_FLASH}: <em>{_file.EXIF_FLASH}</em><br />
				{L_EXIF_WHITEB}: <em>{_file.WHITEB}</em><br />
				{L_EXIF_CAM_MODEL}: <em>{_file.CAM_MODEL}</em><br />
			</div>
overall_header.html --> paste this bewteen the <head> and </head> tags.

Code: Select all

<script language="javascript">
<!--

var state = 'none';

function showhide(layer_ref) {

if (state == 'block') {
state = 'none';
}
else {
state = 'block';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.display = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].display = state;
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(layer_ref);
hza.style.display = state;
}
}
//-->
</script> 
EDIT: FIXED IE7 and FF OK now

Re: NV Exif Data

Posted: Mon Aug 11, 2008 7:26 pm
by GoBieN
But more important information:
Possible SECURITY risk (If "check attachments" is not enabled in ACP).

If a person would alter EXIF code of a picture to read <script ...
java script could get executed, cookies could be stolen, etc ...

escape the output of the EXIF information like this (or better, if you know how):

Code: Select all

						$block_array += array(
							'EXIF_DATE'			=> htmlspecialchars($exif_date),
							'EXIF_FOCAL'		=> htmlspecialchars($exif_focal),
							'EXIF_EXPOSURE'		=> htmlspecialchars($exif_exposure),
							'EXIF_APERTURE'		=> htmlspecialchars($exif_aperture),
							'EXIF_ISO'			=> htmlspecialchars($exif_iso),
							'EXIF_FLASH'		=> htmlspecialchars($exif_flash),

							'WHITEB'		=> htmlspecialchars($exif_whitebalance),
							'CAM_MODEL'		=> htmlspecialchars($exif_model),
							'S_EXIF_DATA'	=> true,
							'EXIF_IMAGE_ID' => $attachment['attach_id'],
							
						);
ps: The EXIF_IMAGE_ID' line is me finding a solution for show/hide IE7 style ;)