From 2ea665ef86c5573c244ebbba797fb31cadf6752b Mon Sep 17 00:00:00 2001 From: Andreas Unterkircher Date: Sat, 24 May 2008 09:26:11 +0200 Subject: [PATCH] issue121, show rating value in photo-index- and single-photo-view Signed-off-by: Andreas Unterkircher --- phpfspot.class.php | 26 ++++++++++++++++++++++ resources/rating.png | Bin 0 -> 686 bytes resources/star.png | Bin 0 -> 670 bytes themes/default/templates/photo_index.tpl | 8 +++++++ themes/default/templates/single_photo.tpl | 7 ++++++ 5 files changed, 41 insertions(+) create mode 100644 resources/rating.png create mode 100644 resources/star.png diff --git a/phpfspot.class.php b/phpfspot.class.php index e6c4aff..0711499 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -506,6 +506,28 @@ class PHPFSPOT { } // getPhotoName() + /** + * get photo rating level + * + * this function will return the integer-based rating + * level of the photo. This can only be done, if the F-Spot + * database is at a specific level. If rating value can not + * be found, zero will be returned indicating no rating value + * is available. + * @param integer idx + * @return integer + */ + public function get_photo_rating($idx) + { + if($detail = $this->get_photo_details($idx)) { + if(isset($detail['rating'])) + return $detail['rating']; + } + + return 0; + + } // get_photo_rating() + /** * shrink text according provided limit * @@ -643,6 +665,7 @@ class PHPFSPOT { $this->tmpl->assign('description', $details['description']); $this->tmpl->assign('image_name', $this->parse_uri($details['uri'], 'filename')); + $this->tmpl->assign('image_rating', $this->get_photo_rating($photo)); $this->tmpl->assign('width', $info_thumb[0]); $this->tmpl->assign('height', $info_thumb[1]); @@ -1232,6 +1255,7 @@ class PHPFSPOT { $img_name[$thumbs] = Array(); $img_fullname[$thumbs] = Array(); $img_title = Array(); + $img_rating = Array(); for($i = $begin_with; $i < $end_with; $i++) { @@ -1242,6 +1266,7 @@ class PHPFSPOT { $img_name[$thumbs] = htmlspecialchars($this->getPhotoName($photos[$i], 15)); $img_fullname[$thumbs] = htmlspecialchars($this->getPhotoName($photos[$i], 0)); $img_title[$thumbs] = "Click to view photo ". htmlspecialchars($this->getPhotoName($photos[$i], 0)); + $img_rating[$thumbs] = $this->get_photo_rating($photos[$i]); $thumb_path = $this->get_thumb_path($this->cfg->thumb_width, $photos[$i]); @@ -1389,6 +1414,7 @@ class PHPFSPOT { $this->tmpl->assign('img_name', $img_name); $this->tmpl->assign('img_fullname', $img_fullname); $this->tmpl->assign('img_title', $img_title); + $this->tmpl->assign('img_rating', $img_rating); $this->tmpl->assign('thumbs', $thumbs); $this->tmpl->assign('selected_tags', $this->getSelectedTags('img')); diff --git a/resources/rating.png b/resources/rating.png new file mode 100644 index 0000000000000000000000000000000000000000..c39b428f0a490fec3a0090001e11d13b7ddb1049 GIT binary patch literal 686 zcmV;f0#W^mP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iOG| z2O$vqlh@z?00J&aL_t(I%iU5-XcJKsJ#S`G^DQ<_n$$KZ5u&9awHiSzR>Y0yHsC@R z1&fk}v~F}+To`cSLWmlaf?%Z!MIWkfzp8lw|UsWF6Y zHLb-f@zIwXF;a6$rBa;(gGcAu+k7F$7&zx(jKS%2cLn@`Ax+ouX7=@60GkMerV^Jg zIPUZMLyWP%WO5F0P<$?lgGYuRpN++)#7zW;E>2vwJ6(O0T3dRhltL1SpAmjzb!X$@ ziTIQo0EFo9qf?C5{eHJ#sd^nmARy#-Gy(xk%fyd-7TsQ&vl@oVf!La9JOBWJQ+B4m zWp2jf@dPwoL$NGFGc*{c0nMmGF6FTDdI+ zsazx1Mg}6`@M*8Ny<69Hqae%Kck>HRCMTaQ15g1pnt%l$Ot!EqZYUW8K)1@}Cuh+9 U*5KRhiU0rr07*qoM6N<$f^H5t?EnA( literal 0 HcmV?d00001 diff --git a/resources/star.png b/resources/star.png new file mode 100644 index 0000000000000000000000000000000000000000..b88c8578956ceec4ff17f81995b8652f6aa2b58d GIT binary patch literal 670 zcmV;P0%84$P)rx?szq&Dw38OK zY!^{rCAFy_2z8TV&4=Ube7+y|oYO*02OOyb5BD7I^ZdAQt`ZS+tMaFrb6^=AxbXHx zH;=|4CCm%L{PZwSS3v3G^sH+#W3JcR_xs(&`Tqt8^J9}d0vU#im5^f#04JL4qMaI^seoYDXwB>7;oyw=|M z1!ayym?6XvqV3ae_f95{py8ukt2TxB^!VIzRRh4#rNu~y^X+P>L{SXo3_|Qqm>9wY zz(9!5s#OBElpmj4DRyjO`0`RiEIkUg%7D)8y}}Ye3}prow;JG>UQOIs{kfZSJ9bYz zskMPbH9)1H6FDf)1=ZKVfe+;jf`a(O{!9meiN~~d0iA$0qX=t0D6Ydx4#RO76h@#R z9_k7Z;$fv6G>QeZ{Yu0n&xL4%!?l}UPj4!j&Vs@?dl=y8#_IQ`5I-5a_T$dJtJ_~5 z4&186>klZh{hfba {$img_name[thumb]} + { if $use_lightbox } { /if } + + { if $img_rating[thumb] } +
+ {section name="rating" loop=$img_rating[thumb] step=1} + + {/section} + { /if } {/if} diff --git a/themes/default/templates/single_photo.tpl b/themes/default/templates/single_photo.tpl index 97ef0cf..b141517 100644 --- a/themes/default/templates/single_photo.tpl +++ b/themes/default/templates/single_photo.tpl @@ -42,6 +42,13 @@ {$ExifOrigResolution}
{ /if } Size: {$ExifFileSize}
+ { if $image_rating } + rating Rating:
+ {section name="rating" loop=$image_rating step=1} + + {/section} +
+ { /if } { if $tags }
available tags Tagged with:
-- 2.34.1