public function getPhotoName($idx, $limit = 0)
{
if($details = $this->get_photo_details($idx)) {
- $name = $details['name'];
- if($limit != 0 && strlen($name) > $limit) {
- $name = substr($name, 0, $limit-5) ."...". substr($name, -($limit-5));
- }
+ $name = $this->shrink_text($details['name'], $limit);
return $name;
}
} // getPhotoName()
+ /**
+ * shrink text according provided limit
+ *
+ * If the length of the name exceeds $limit the
+ * text will be shortend and some content in between
+ * will be replaced with "..."
+ */
+ private function shrink_text($text, $limit)
+ {
+ if($limit != 0 && strlen($text) > $limit) {
+ $text = substr($text, 0, $limit-5) ."...". substr($text, -($limit-5));
+ }
+
+ return $text;
+
+ } // shrink_text();
+
/**
* translate f-spoth photo path
*