Will the EXIF page be translated into English? Now it is in Chinese only. Not critical for now, but would be nice. Thank you.

CommentFileSizeAuthor
#4 photos.zip1.79 KBvidda
#2 photos.page_.zip10.98 KBvidda

Comments

eastcn’s picture

My English is very bad, exif terms of professional too, need someone to help translate English.
Perhaps you are willing to help. Photos.pager.inc in the document can be found.
thanks

vidda’s picture

StatusFileSize
new10.98 KB

My English is not very good too but I am glad to help you. Here is the translated function _photos_getexif from the end of photos.page.inc . Please integrate it to the next release. I also attach my updated file from 2.5beta1 to avoid formating problems.

function _photos_getexif($img,$type = false,$url = false) {
$imgtype = array("", "GIF", "JPG", "PNG", "SWF", "PSD", "BMP", "TIFF(intel byte order)", "TIFF(motorola byte order)", "JPC", "JP2", "JPX", "JB2", "SWC", "IFF", "WBMP", "XBM");
$Orientation = array("", "top left side", "top right side", "bottom right side", "bottom left side", "left side top", "right side top", "right side bottom", "left side bottom");
$ResolutionUnit = array("", "", "inches", "centimeters");
$YCbCrPositioning = array("", "the center of pixel array", "the datum point");
$ExposureProgram = array("Not defined","Manual", "Normal program", "Aperture priority", "Shutter priority", "Creative program (biased toward depth of field)", "Action program (biased toward fast shutter speed)", "Portrait mode (for closeup photos with the background out of focus)", "Landscape mode (for landscape photos with the background in focus)");
$MeteringMode_arr = array(
"0" => "unknown",
"1" => "Average",
"2" => "CenterWeightedAverage",
"3" => "Spot",
"4" => "MultiSpot",
"5" => "Pattern",
"6" => "Partial",
"255" => "other"
);
$Lightsource_arr = array(
"0" => "unknown",
"1" => "Daylight",
"2" => "Fluorescent",
"3" => "Tungsten (incandescent light)",
"4" => "Flash",
"9" => "Fine weather",
"10" => "Cloudy weather",
"12" => "Daylight fluorescent (D 5700 – 7100K)",
"13" => "Day white fluorescent (N 4600 – 5400K)",
"14" => "Cool white fluorescent (W 3900 – 4500K)",
"15" => "White fluorescent (WW 3200 – 3700K)",
"17" => "Standard light A",
"18" => "Standard light B",
"19" => "Standard light C",
"20" => "D55",
"21" => "D65",
"22" => "D75",
"23" => "D50",
"24" => "ISO studio tungsten",
"255" => "other light source"
);
$Flash_arr = array(
"0" => "Flash did not fire.",
"1" => "Flash fired.",
"5" => "Strobe return light not detected.",
"7" => "Strobe return light detected.",
"9" => "Flash fired, compulsory flash mode",
"13" => "Flash fired, compulsory flash mode, return light not detected",
"15" => "Flash fired, compulsory flash mode, return light detected",
"16" => "Flash did not fire, compulsory flash mode",
"24" => "Flash did not fire, auto mode",
"25" => "Flash fired, auto mode",
"29" => "Flash fired, auto mode, return light not detected",
"31" => "Flash fired, auto mode, return light detected",
"32" => "No flash function",
"65" => "Flash fired, red-eye reduction mode",
"69" => "Flash fired, red-eye reduction mode, return light not detected",
"71" => "Flash fired, red-eye reduction mode, return light detected",
"73" => "Flash fired, compulsory flash mode, red-eye reduction mode",
"77" => "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",
"79" => "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",
"89" => "Flash fired, auto mode, red-eye reduction mode",
"93" => "Flash fired, auto mode, return light not detected, red-eye reduction mode",
"95" => "Flash fired, auto mode, return light detected, red-eye reduction mode"
);

$exif = @exif_read_data ($img,"IFD0");
if ($exif) {
$exif = @exif_read_data($img,0,true);
if($type == 't'){
$new_img_info = array (
"Artist" => $exif[IFD0][Artist],
"FileType" => $imgtype[$exif[FILE][FileType]],
"MimeType" => $exif[FILE][MimeType],
"FileSize" => (floor($exif[FILE][FileSize] / 1024 * 10 )/10)."KB",
"FileDateTime" => date("Y:m:d H:i:s",$exif[FILE][FileDateTime]),
"Make" => $exif[IFD0][Make],
"Model" => $exif[IFD0][Model],
"DateTime" => $exif[IFD0][DateTime],
"ExifVersion" => $exif[EXIF][ExifVersion],
"DateTimeOriginal" => $exif[EXIF][DateTimeOriginal],
"DateTimeDigitized" => $exif[EXIF][DateTimeDigitized],
"Height" => $exif[COMPUTED][Height].'px',
"Width" => $exif[COMPUTED][Width].'px',
"CompressedBitsPerPixel" => $exif[EXIF][CompressedBitsPerPixel]."Bits/Pixel",
"FocusDistance" => !empty($exif[COMPUTED][FocusDistance]) ? $exif[COMPUTED][FocusDistance]."m":NULL,
"FocalLength" => !empty($exif[EXIF][FocalLength]) ? $exif[EXIF][FocalLength]."mm":NULL,
"FocalLengthIn35mmFilm" => !empty($exif[EXIF][FocalLengthIn35mmFilm]) ? $exif[EXIF][FocalLengthIn35mmFilm]."mm":NULL,
"ColorSpace" => ($exif[EXIF][ColorSpace]==1?"sRGB":"Uncalibrated"),
);
$more = l(t('Show details'),$url);
}else{
$new_img_info = array (
"FileName" => $exif[FILE][FileName],
"FileType" => $imgtype[$exif[FILE][FileType]],
"MimeType" => $exif[FILE][MimeType],
"FileSize" => (floor($exif[FILE][FileSize] / 1024 * 10 )/10)."KB",
"FileDateTime" => date("Y-m-d H:i:s",$exif[FILE][FileDateTime]),
"ImageDescription" => $exif[IFD0][ImageDescription],
"Make" => $exif[IFD0][Make],
"Model" => $exif[IFD0][Model],
"Orientation" => $Orientation[$exif[IFD0][Orientation]],
"XResolution" => $exif[IFD0][XResolution].$ResolutionUnit[$exif[IFD0][ResolutionUnit]],
"YResolution" => $exif[IFD0][YResolution].$ResolutionUnit[$exif[IFD0][ResolutionUnit]],
"Software" => drupal_convert_to_utf8($exif[IFD0][Software],'gbk'),
"DateTime" => $exif[IFD0][DateTime],
"Artist" => $exif[IFD0][Artist],
"YCbCrPositioning" => $YCbCrPositioning[$exif[IFD0][YCbCrPositioning]],
"Copyright" => $exif[IFD0][Copyright],
"Photographer" => $exif[COMPUTED][Copyright.Photographer],
"Editor" => $exif[COMPUTED][Copyright.Editor],
"ExifVersion" => $exif[EXIF][ExifVersion],
"FlashPixVersion" => "Ver. ".number_format($exif[EXIF][FlashPixVersion]/100,2),
"DateTimeOriginal" => $exif[EXIF][DateTimeOriginal],
"DateTimeDigitized" => $exif[EXIF][DateTimeDigitized],
"Height" => $exif[COMPUTED][Height].'px',
"Width" => $exif[COMPUTED][Width].'px',
"ApertureValue" => $exif[EXIF][ApertureValue],
"ShutterSpeedValue" => $exif[EXIF][ShutterSpeedValue],
"ApertureFNumber" => $exif[COMPUTED][ApertureFNumber],
"MaxApertureValue" => "F".$exif[EXIF][MaxApertureValue],
"ExposureTime" => $exif[EXIF][ExposureTime],
"F-Number" => $exif[EXIF][FNumber],
"MeteringMode" => _photos_getval($exif[EXIF][MeteringMode],$MeteringMode_arr),
"LightSource" => _photos_getval($exif[EXIF][LightSource], $Lightsource_arr),
"Flash" => _photos_getval($exif[EXIF][Flash], $Flash_arr),
"ExposureMode" => ($exif[EXIF][ExposureMode]==1?"Manual exposure":"Auto exposure"),
"WhiteBalance" => ($exif[EXIF][WhiteBalance]==1?"Manual white balance":"Auto white balance"),
"ExposureProgram" => $ExposureProgram[$exif[EXIF][ExposureProgram]],
"ExposureBiasValue" => $exif[EXIF][ExposureBiasValue]."EV",
"ISOSpeedRatings" => $exif[EXIF][ISOSpeedRatings],
"ComponentsConfiguration" => (bin2hex($exif[EXIF][ComponentsConfiguration])=="01020300"?"YCbCr":"RGB"),
"CompressedBitsPerPixel" => $exif[EXIF][CompressedBitsPerPixel]."Bits/Pixel",
"FocusDistance" => $exif[COMPUTED][FocusDistance]."m",
"FocalLength" => $exif[EXIF][FocalLength]."mm",
"FocalLengthIn35mmFilm" => $exif[EXIF][FocalLengthIn35mmFilm]."mm",
"UserCommentEncoding" => $exif[COMPUTED][UserCommentEncoding],
"UserComment" => $exif[COMPUTED][UserComment],
"ColorSpace" => ($exif[EXIF][ColorSpace]==1?"sRGB":"Uncalibrated"),
"ExifImageLength" => $exif[EXIF][ExifImageLength],
"ExifImageWidth" => $exif[EXIF][ExifImageWidth],
"FileSource" => (bin2hex($exif[EXIF][FileSource])==0x03?"DSC":"unknown"),
"SceneType" => (bin2hex($exif[EXIF][SceneType])==0x01?"A directly photographed image":"unknown"),
"Thumbnail.FileType" => $exif[COMPUTED][Thumbnail.FileType],
"Thumbnail.MimeType" => $exif[COMPUTED][Thumbnail.MimeType]
);
}
}elseif($type != 't'){
$new_img_info = array (t("Information") => t("This image does not have EXIF information"));
}

$output = '';
if($new_img_info){
$header = array(array('data'=> t('EXIF information')),array('data'=>$more,'class'=>'rg'));
foreach($new_img_info as $name=>$val) {
$row = array();
if($val){
$row[] = $name;
$row[] = $val;
$rows[] = $row;
}
}
$output = theme('table', $header, $rows,array('id'=>'photo-exif'));
}
return $output;
}

vidda’s picture

I have another change to photos.page.inc, please implement it to your version of this file.

on line 701 should be

$setcover = l(t('Set to album cover. '),"node/$img->pid/photos/setcover/$fid", array('query' => drupal_get_destination()));

instead of

$setcover = l(t('Is set to album cover. '),"node/$img->pid/photos/setcover/$fid", array('query' => drupal_get_destination()));

Now is the meaning OK.
And I will be glad to help you with other things.

vidda’s picture

StatusFileSize
new1.79 KB

And another change in photos.css to be compatible with drupal themes. In short - 3 background hardcoded definitions deleted, the look is much better because module much more looks like part of drupal, it now uses drupal theme colors as it should.
New photos.css from 2.5beta1 attached.

line 37
.photos-des{background:#F0EDCE;text-align:right}
.photos-des{text-align:right}

line 8
.editdes,.image-b{background:#E8F5E8;font-size:14px;color:#176436;padding:5px;}
.editdes,.image-b{font-size:14px;color:#176436;padding:5px;}

line 41
#photo-exif tr{background:#fff;}
deleted

eastcn’s picture

Thank you for your translation, will join the next release.

"module" and "theme" is different. However, the definition of background color, in full compliance with drupal module coding standard.
The right way: "themes / youname / style.css", re-definition of css.
here: http://cvs.drupal.org/viewvc.py/drupal/drupal/modules/system/system.css?...

vidda’s picture

OK, I moved it to my style.ccs. It is better solution. Thank you. I am always learning... :-)

berdir’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.