<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>Add support for contact photos with ability to sync</title> 
  <pubDate>Sun, 05 Apr 2026 22:40:35 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/5971</link> 
  <atom:link rel="self" type="application/rss+xml" title="Add support for contact photos with ability to sync" href="https://bugs.horde.org/ticket/5971/rss" /> 
  <description>Add support for contact photos with ability to sync</description> 
 
   
   
  <item> 
   <title>Just started to play with horde/sync and my E51 syncs really</title> 
   <description>Just started to play with horde/sync and my E51 syncs really fine with turba, but I miss the little photos you can attach to your contacts on your mobile. Is it possible to add photo support to turba (and its sync, of course)?



A vCard would contain something like:



PHOTO;TYPE=JPEG;ENCODING=BASE64:

    /9j/4AAQSkZJRgABAQ ...

</description> 
   <pubDate>Thu, 06 Dec 2007 16:06:20 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5971#t39504</link> 
  </item> 
   
  <item> 
   <title>This is already planned, but we do not have a time frame.</title> 
   <description>This is already planned, but we do not have a time frame.</description> 
   <pubDate>Thu, 06 Dec 2007 16:15:25 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5971#t39507</link> 
  </item> 
   
  <item> 
   <title>This is a quick and dirty hack to add a photo element to tur</title> 
   <description>This is a quick and dirty hack to add a photo element to turba that can be synced. This is NOT a patch for common use but for my special case with a lot of assumptions made, e.g.:



a) turba is just a storage place (attribute is readonly)

b) photo is base64 (seems to be reasonable)

c) only one external client is syncing, 

    so no format checking or anything like that



Using this hack allows for adding photos to contacts (on MY nokia) that survive a bi-directional sync.</description> 
   <pubDate>Sun, 09 Dec 2007 13:17:45 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5971#t39627</link> 
  </item> 
   
  <item> 
   <title>&gt; This is a quick and dirty hack to add a photo element to t</title> 
   <description>&gt; This is a quick and dirty hack to add a photo element to turba that 



hmpf, my patch actually didn´t do the trick. Thus, a new one for syncing photos from Nokia E51 to turba (h3-2.2)



It´s still a hack, as I circumvent the encoding stuff in iCalendar.php and do it myself, but it should be a good guide for someone implementing it the proper way.



The photo is stored as base64 in the turba contact at the moment. Thus, I set the photo attribute to read-only. However, it would be really really cool, if someone could tell me, how to use an image form field for a contact. Should be similar to files, but they are treated different from the rest of the attributes :-/



  Martin</description> 
   <pubDate>Sat, 07 Jun 2008 19:29:41 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5971#t46089</link> 
  </item> 
   
  <item> 
   <title>If you do a chop and explicitly add a CR LF for terminating </title> 
   <description>If you do a chop and explicitly add a CR LF for terminating the base64 string 

in the first chunk of Driver.php in patch.photo.turba-h3-2.2.diff, i.e.



                $vcard-&gt;setAttribute(&#039;PHOTO;ENCODING=BASE64&#039;, &quot;\r\n&quot; . 

                                     chop(chunk_split(preg_replace(&#039;/(\r\n|\r|\n| )/&#039;,&#039;&#039;,$val,-1), 

                                                      64,&quot;\r\n&quot;)) . 

                                     &quot;\r\n&quot;); 





you can drop the read-only parameter from the photo attribute. As long as you put a base64 photo (only tested jpeg) in the longtext form field, it syncs fine to the E51 :o)



   Martin

</description> 
   <pubDate>Sat, 07 Jun 2008 20:29:38 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5971#t46090</link> 
  </item> 
   
  <item> 
   <title>This has been implemented for Turba 2.2.2.</title> 
   <description>This has been implemented for Turba 2.2.2.</description> 
   <pubDate>Tue, 12 Aug 2008 15:19:37 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5971#t48158</link> 
  </item> 
   
  <item> 
   <title>Hi, just upgraded to current turba 2.3

and run into some pr</title> 
   <description>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 != &#039;&#039;); 

        } else { 

            if (count($var) == 0) { return false; }    &lt;&lt;===

            foreach ($var as $v) { 

       ...



Storing in turba DB doesn&#039;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(&#039;/[\r\n]+[ \t]/&#039;, &#039;&#039;, $vCal); 

+       $vCal = preg_replace(&#039;/[\r\n]+[ \t]+/&#039;, &#039;&#039;, $vCal); 

+       $vCal = preg_replace(&#039;/\r\n\r\n/&#039;, &quot;\r\n&quot;, $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 &#039;photo&#039;:

            case &#039;logo&#039;:

                $params = array(&#039;ENCODING&#039; =&gt; &#039;base64&#039;);

                if (isset($hash[$key . &#039;type&#039;])) {

                    $params[&#039;TYPE&#039;] = $hash[$key . &#039;type&#039;];

                }

                $vcard-&gt;setAttribute(String::upper($key), 

-                                    base64_encode($val), 

+                                    base64_encode($val) . &quot;\r\n&quot;, 

                                     $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-&gt;hasValue($this-&gt;columns[$c - 1])) { 

        $value = $ob-&gt;getValue($this-&gt;columns[$c - 1]); 

-        $shown_columns[$c] = htmlspecialchars($value)

+        $shown_columns[$c] = is_array($value) ? $value : htmlspecialchars($value); 

        if ($type == &#039;email&#039;) { 



   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 &#039;b&#039;. Is that a valid encoding name at all? Changed

   it to &#039;base64&#039; and it worked again. In turba/lib/Driver.php



            case &#039;photo&#039;: 

            case &#039;logo&#039;: 

-               $params = array(&#039;ENCODING&#039; =&gt; &#039;b&#039;); 

+               $params = array(&#039;ENCODING&#039; =&gt; &#039;base64&#039;); 





                if (!isset($item[&#039;params&#039;][&#039;ENCODING&#039;]) || 

-                   String::lower($item[&#039;params&#039;][&#039;ENCODING&#039;]) != &#039;b&#039;) { 

+                   String::lower($item[&#039;params&#039;][&#039;ENCODING&#039;]) != &#039;base64&#039;) { 

                    // 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.</description> 
   <pubDate>Sat, 27 Sep 2008 19:34:35 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5971#t49264</link> 
  </item> 
   
  <item> 
   <title>&gt; Hi, just upgraded to current turba 2.3

&gt; and run into som</title> 
   <description>&gt; Hi, just upgraded to current turba 2.3

&gt; and run into some problems with PHOTO

&gt;

&gt; 1) storing contact without a photo in LDAP

&gt;

&gt; The attribute array always contains an array for the photo item. If

&gt; there is no photo set, this array is empty, but is not catched by the

&gt; function _emptyAttributeFilter in turba/lib/Driver/ldap.php. This

&gt; results in an error in _add to LDAP. Stripping empty arrays too solves

&gt; at least this problem.

&gt;

&gt;     function _emptyAttributeFilter($var)

&gt;     {

&gt;         if (!is_array($var)) {

&gt;             return ($var != &#039;&#039;);

&gt;         } else {

&gt;             if (count($var) == 0) { return false; }    &lt;&lt;===

&gt;             foreach ($var as $v) {

&gt;        ...

&gt;

&gt; Storing in turba DB doesn&#039;t show this bug, but photos are stored as 0B

&gt; blobs instead of NULL blobs.

&gt;

&gt;

&gt;

&gt; 2) base64 is terminated by a blank line, so eliminate it before

&gt;    matching the following vCalender attributes. Otherwise the name of

&gt;    one following PHOTO will start with a \r\n, so it will be

&gt;    discarded afterward

&gt;

&gt;    in /lib/Horde/iCalendar.php

&gt;

&gt;         // Unfold any folded lines.

&gt; -       $vCal = preg_replace(&#039;/[\r\n]+[ \t]/&#039;, &#039;&#039;, $vCal);

&gt; +       $vCal = preg_replace(&#039;/[\r\n]+[ \t]+/&#039;, &#039;&#039;, $vCal);

&gt; +       $vCal = preg_replace(&#039;/\r\n\r\n/&#039;, &quot;\r\n&quot;, $vCal);

&gt;

&gt;    (First line only beautifies the base64 code by stripping all

&gt;    whitespace. The second line does the necessary work by deleting all

&gt;    blank lines.)

&gt;

&gt;    and add the blank line in /turba/lib/Driver.php again before

&gt;    sending to mobile:

&gt;

&gt;             case &#039;photo&#039;:

&gt;             case &#039;logo&#039;:

&gt;                 $params = array(&#039;ENCODING&#039; =&gt; &#039;base64&#039;);

&gt;                 if (isset($hash[$key . &#039;type&#039;])) {

&gt;                     $params[&#039;TYPE&#039;] = $hash[$key . &#039;type&#039;];

&gt;                 }

&gt;                 $vcard-&gt;setAttribute(String::upper($key),

&gt; -                                    base64_encode($val),

&gt; +                                    base64_encode($val) . &quot;\r\n&quot;,

&gt;                                      $params);

&gt;                 break;

&gt;

&gt;

&gt;

&gt; 3) Browsing the address book with photo as a visible column results in a

&gt;    warning per entry containing a photo:

&gt;

&gt;    Warning: htmlspecialchars() expects parameter 1 to be string, array

&gt;    given in 

&gt; /var/www/org.afaik.duff_ssl/mail-new/turba/templates/browse/row.inc

&gt;    on line 90

&gt;

&gt;        if ($ob-&gt;hasValue($this-&gt;columns[$c - 1])) {

&gt;         $value = $ob-&gt;getValue($this-&gt;columns[$c - 1]);

&gt; -        $shown_columns[$c] = htmlspecialchars($value)

&gt; +        $shown_columns[$c] = is_array($value) ? $value : 

&gt; htmlspecialchars($value);

&gt;         if ($type == &#039;email&#039;) {

&gt;

&gt;    No thinking on my side, just getting rid of this warning, so check

&gt;    again.

&gt;

&gt;

&gt;

&gt; 4) In toHash and tovCard, the encoding of a photo is tested against

&gt;    and set to &#039;b&#039;. Is that a valid encoding name at all? Changed

&gt;    it to &#039;base64&#039; and it worked again. In turba/lib/Driver.php

&gt;

&gt;             case &#039;photo&#039;:

&gt;             case &#039;logo&#039;:

&gt; -               $params = array(&#039;ENCODING&#039; =&gt; &#039;b&#039;);

&gt; +               $params = array(&#039;ENCODING&#039; =&gt; &#039;base64&#039;);

&gt;

&gt;

&gt;                 if (!isset($item[&#039;params&#039;][&#039;ENCODING&#039;]) ||

&gt; -                   String::lower($item[&#039;params&#039;][&#039;ENCODING&#039;]) != &#039;b&#039;) {

&gt; +                   String::lower($item[&#039;params&#039;][&#039;ENCODING&#039;]) != &#039;base64&#039;) {

&gt;                     // Invalid property.

&gt;                     break;

&gt;

&gt;

&gt; 5) Finally, how am I supposed to delete a photo from a contact or save

&gt;    it to a local file (e.g. for doing some cropping stuff in an external

&gt;    tool)? There are no delete and save buttons as for a common file.

&gt;

&gt;

&gt; Having this patched, I can add (ldap), change, view and sync photos

&gt;

&gt;      Martin

&gt;

&gt; PS: any thoughts on adding crop support? Photos taken by mobiles have 

&gt; a stupid format for contact photos. Otherwise, I could live with as 

&gt; save as local file button.



Please open a new ticket rather than responding on a closed one.</description> 
   <pubDate>Mon, 29 Sep 2008 04:14:55 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/5971#t49279</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
