6.0.0-beta1
▾
Tasks
New Task
Search
Photos
Wiki
▾
Tickets
New Ticket
Search
dev.horde.org
Toggle Alerts Log
Help
8/19/25
H
istory
A
ttachments
C
omment
W
atch
Download
Comment on [#5971] Add support for contact photos with ability to sync
*
Your Email Address
*
Spam protection
Enter the letters below:
._..__..__.. .. . | | || |\ /|__| _|_|__||__| \/ | |
Comment
> Hi, just upgraded to current turba 2.3 > > and run into some problems with PHOTO > > > > 1) storing contact without a photo in LDAP > > > > The attribute array always contains an array for the photo item. If > > there is no photo set, this array is empty, but is not catched by the > > function _emptyAttributeFilter in turba/lib/Driver/ldap.php. This > > results in an error in _add to LDAP. Stripping empty arrays too solves > > at least this problem. > > > > function _emptyAttributeFilter($var) > > { > > if (!is_array($var)) { > > return ($var != ''); > > } else { > > if (count($var) == 0) { return false; } <<=== > > foreach ($var as $v) { > > ... > > > > Storing in turba DB doesn't show this bug, but photos are stored as 0B > > blobs instead of NULL blobs. > > > > > > > > 2) base64 is terminated by a blank line, so eliminate it before > > matching the following vCalender attributes. Otherwise the name of > > one following PHOTO will start with a \r\n, so it will be > > discarded afterward > > > > in /lib/Horde/iCalendar.php > > > > // Unfold any folded lines. > > - $vCal = preg_replace('/[\r\n]+[ \t]/', '', $vCal); > > + $vCal = preg_replace('/[\r\n]+[ \t]+/', '', $vCal); > > + $vCal = preg_replace('/\r\n\r\n/', "\r\n", $vCal); > > > > (First line only beautifies the base64 code by stripping all > > whitespace. The second line does the necessary work by deleting all > > blank lines.) > > > > and add the blank line in /turba/lib/Driver.php again before > > sending to mobile: > > > > case 'photo': > > case 'logo': > > $params = array('ENCODING' => 'base64'); > > if (isset($hash[$key . 'type'])) { > > $params['TYPE'] = $hash[$key . 'type']; > > } > > $vcard->setAttribute(String::upper($key), > > - base64_encode($val), > > + base64_encode($val) . "\r\n", > > $params); > > break; > > > > > > > > 3) Browsing the address book with photo as a visible column results in a > > warning per entry containing a photo: > > > > Warning: htmlspecialchars() expects parameter 1 to be string, array > > given in > /var/www/org.afaik.duff_ssl/mail-new/turba/templates/browse/row.inc > > on line 90 > > > > if ($ob->hasValue($this->columns[$c - 1])) { > > $value = $ob->getValue($this->columns[$c - 1]); > > - $shown_columns[$c] = htmlspecialchars($value) > > + $shown_columns[$c] = is_array($value) ? $value : > htmlspecialchars($value); > > if ($type == 'email') { > > > > No thinking on my side, just getting rid of this warning, so check > > again. > > > > > > > > 4) In toHash and tovCard, the encoding of a photo is tested against > > and set to 'b'. Is that a valid encoding name at all? Changed > > it to 'base64' and it worked again. In turba/lib/Driver.php > > > > case 'photo': > > case 'logo': > > - $params = array('ENCODING' => 'b'); > > + $params = array('ENCODING' => 'base64'); > > > > > > if (!isset($item['params']['ENCODING']) || > > - String::lower($item['params']['ENCODING']) != 'b') { > > + String::lower($item['params']['ENCODING']) != 'base64') { > > // Invalid property. > > break; > > > > > > 5) Finally, how am I supposed to delete a photo from a contact or save > > it to a local file (e.g. for doing some cropping stuff in an external > > tool)? There are no delete and save buttons as for a common file. > > > > > > Having this patched, I can add (ldap), change, view and sync photos > > > > Martin > > > > PS: any thoughts on adding crop support? Photos taken by mobiles have > a stupid format for contact photos. Otherwise, I could live with as > save as local file button.
Attachment
Watch this ticket
N
ew Ticket
M
y Tickets
S
earch
Q
uery Builder
R
eports
Saved Queries
Open Bugs
Bugs waiting for Feedback
Open Bugs in Releases
Open Enhancements
Enhancements waiting for Feedback
Bugs with Patches
Enhancements with Patches
Release Showstoppers
Stalled Tickets
New Tickets
Horde 5 Showstoppers