Synchronize Contact Photos/Pictures between Z-Push and Nextcloud

  • Hi,

    I have setup a server running Nextcloud, which I am using as email, calendar and contact frontend (and of course for file synchronization) and z-push to sync to Outlook or my Android devices. It works almost perfectly.

    The only thing that I cannot get to work is the synchronization of contact photos. I found the setting in z-push to sync pictures of up to 5MB and I kept that standard. 5MB is plenty and should absolutely suffice for my purposes. But when I add a photo to a contact in Nextcloud or on my Android devices they are not synced. I am sure I have to change some settings I just could not find them, neither in Nextcloud nor in z-push.
    Can anybody point me in the right direction? That would be fantastic.

    Thanks in advance.


  • Kopano

    Hi @Realshadow,

    can you enable wbxml logging for your user and post the relevant logging when a contact picture is synced to your phone?

  • Sure. I will need until the weekend though. My “honey-do-list” got too long and I need to reduce that during the week. I will do that on the WE. Thanks for looking into it.


  • Hello @fbartels

    I followed your instructions and setup the WBXML logging. here is the result. (sorry it is so long). I replaced my username with “USER” and the contact name and email address was replaced mostly by stars.

    Thank you for your help.

    I uploaded the doc and you should be able to access it here


  • Kopano

    Hi Realshadow,

    the carddav backend was a community contribution and I’m not very familiar with its code, but it looks like it doesn’t support png images. Did you try a jpeg as a contact image?


  • Actually I didn’t. I will try as soon as I get home. I thought it wouldn’t matter but we’ll see. I will let you know later today.

  • Good Morning @fbartels, @Manfred

    I tried this morning to synchronize a JPEG. I logged into my nextcloud account and uploaded a JPEG to a contact. Unfortunately it did not synchronize but I activated WBXML. You can find that here.

    Again, thanks for looking into it.


  • Kopano

    Hi Realshadow,

    it looks like image parsing doesn’t work properly in the carddav backend (or maybe the carddav backend isn’t able to process image data which comes from the nextcloud). The picture tag in WBXML contains only “data:image/jpeg” (it was similar for png image, but as there is jpeg type in code I thought it might work for jpegs).

    I’ve created a JIRA issue to follow up:


  • Thank you very much @Manfred. Is there anything I can do to help? How should the tag look like properly? Do you have an example?

  • Kopano

    Hi Realshadow,

    if you have PHP knowledge you could contribute a fix ;).

    I don’t have an actual example but the tag should contain base64-encoded picture data ("/9j/4AAQSkZJRgABAQEASABIAAD/4S86RXhp…").


  • @Manfred, I do have some knowledge and I was looking into the code of the carddav backend but seems that my knowledge is not sufficient for that yet. I will look into it a little more on the weekend but I do not have the indepth knowledge that I would need to assist. Sorry. But I will try my best to be a helpfull tester :-)

  • I have also huge problems with the CardDAV Backend. In my case, the contact pictures are stored. But all images will be reduced to 96x96 pixels. In /etc/z-psh/z-push.conf.php i have the default

    define('SYNC_CONTACTS_MAXPICTURESIZE', 5242880);

    set. I haven’t found anything other. All images are JPEG files.

  • Kopano

    Hi Linseece,

    Is the source of your contacts also nextcloud?

    Where are the images reduced to that size? When you create a contact in nextcloud and sync to the mobile, they are 96x96 pixels on the mobile? Or vice versa?

    Please provide WBXML log for such a contact being synced.


  • I have tested a little bit more. If i use the standard Samsung Exchange Account and create a contact on the mobile, it saves the contact on the server with 395x395px. But if i change afterwards something on the contact with the contact app of the Samsung device, the contact picture size is reduced to 96x96px.

    Now i try the same with the app Nine. Maybe i get better results. It has its own sync engine and contact editor. In the past, i had better results with that app.

  • @Manfred in my case it’s not directly Nextcloud. I use SabreDAV as backend, but since NextCloud is based heavily on SabreDAV, i think, its nearby the same. After a long absence from Z-Push, this is my first retry after a long time. Maybe i miss something… SabreDAV is synced also to a Roundcube instance, since i have no idea, how get mails in Kopano directly from a external IMAP server (without using fetchmail or such things).

  • Ok another test:

    • Samsung Account deleted (to stop syncing and destroying results)
    • Created Account in App Nine
    • Created contact in Nine with picture size 350x350px
    • After sync, checked the server: The contact is saved there with picture size 350x350px
    • changed contact in Roundcube
    • the change is visible on the mobile
    • checked mobile: Picture is at 350x350px

    So it seems, that using Nine, at least for picture size, its more stable as this Samsung Apps. This was only a test with one Contact. I hope its the same with all the other contacts.

    As i have seen, using JPEG as picture format seems to be mandatory for using BackendCardDAV, since its hard-coded at at line 1303 in carddav.php. Not a big deal for me. I try batch convert my pictures before i use them.

  • If Windows 10 Mail Client is involved (DeviceType=WindowsMail MSFT-WIN-3/10.0.17763) and the contact is edited there, the contact picture is downsized also to 96x96px. Again ,if i use only the Android App Nine, all works as expected and the contact picture stays on a much bigger size.

    I don’t know, if there anything could be done in that case, since it seems to be a client issue. Maybe Windows Mail and Samsung build-in client interpret the card data in some unexpected way.

    For testing, i use now a dedicated copy of the sabredav database with a different url, do not mix the content. So if someone needs some special tests, he/she is welcome to ask.

    @Manfred: In the case you want a testbed at that server, you can send me a private message in english or german.

  • Kopano

    Hi Linseece,

    then probably Windows Mail rescales the image. Did you try to set a smaller image than 96x96px if it will be upscaled to that size when Windows Mail is involved?


  • I test that tomorrow. Since it’s possible to add CardDAV servers to Windows Mail via iCloud, i have done that today. If i add or change a contact via Windows Mail CardDAV Account, the is no down-scaling. So it seems, that this is a effect only for EAS Account types. Regarding upscaling, i report you my results tomorrow.

  • Im back :-)

    • Added the account as EAS Account in WindowsMail MSFT-WIN-3/10.0.17763

    • Changed a Contact (added a second name) where i have a big contact picture

    • Save that Contact

    • Checked online the Contact

    • Contact Picture is now at 112x112px, the changed name is also visible

    • Now changed another contact and added a picture with 52x52px, since smaller sizes are not allowed

    • Saved Contact

    • Checked Contact online

    • Contact picture is at 614x614px… wow, thats blurry and ugly

    If i try the same steps with a CardDAV Accout (iCloud), all infos/pictures stays intact

Log in to reply