begin the process of using the relevant attach directory/path for photo albums instead of an album basename which may not be unique. Created an 'ellipsify()' function to shorten long names and keep the beginning and end intact

This commit is contained in:
zotlabs
2017-03-21 20:11:48 -07:00
committed by Mario Vavti
parent 542fa4a08c
commit b03cd330e5
4 changed files with 62 additions and 48 deletions

View File

@@ -3130,3 +3130,14 @@ function array_escape_tags(&$v,$k) {
$v = escape_tags($v);
}
function ellipsify($s,$maxlen) {
if($maxlen & 1)
$maxlen --;
if($maxlen < 4)
$maxlen = 4;
if(mb_strlen($s) < $maxlen)
return $s;
return mb_substr($s,0,$maxlen / 2) . '...' . mb_substr($s,mb_strlen($s) - ($maxlen / 2));
}