Hi all,
Since I needed photo functionality for VCard in my project, I've decided to implement it.
Specifically, the client asked for the VCard to show a photo when opening it with e.g. Outlook.
According to the VCard specification I think this is doable by base64 encoding the photo and having the encoded string in the VCard. I've added a photo field that takes an online URL, encodes it and passes it to the card.
You're welcome to test my patch and provide feedback (see if the VCard shows a photo when you open it with a mail client that supports VCards). I think you have to reinstall the module when you apply this patch though - not sure.
Thanks,
Kyriakos
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | vcardfield_7.12c.patch | 4.41 KB | michaelpporter |
| #10 | vcardfield_7.12b.patch | 494 bytes | michaelpporter |
| #7 | vcardfield_7.12a.patch | 500 bytes | michaelpporter |
| #1 | vcardfield-add_photo_functionality.patch | 2.95 KB | cirrus3d |
Comments
Comment #1
cirrus3d commentedIncluding the patch for the photo functionality here (note this is against 7.x-1.10)
Comment #4
michaelpporter commentedAdded to 7.11. Thank you.
Comment #5
mattew commentedHi,
I updated the module this morning, from 1.8 to 1.11, and now I get some errors about photo field :
Undefined property: stdClass::$field_address_vcard_photo in field_sql_storage_field_storage_load() (line 406 of ...\modules\field\modules\field_sql_storage\field_sql_storage.module).and
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_address_vcard_photo' in 'field list': (the query...) in field_sql_storage_field_storage_write() (line 494 of ...\modules\field\modules\field_sql_storage\field_sql_storage.module).and
Exception: exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_address_vcard_photo' in 'field list'' in ...\includes\database\database.inc:2171 Stack trace: (...)I think the problem is that the photo field has been added to the schema but no hook_update has been written to support migration from older versions.
I think it's a major issue because updating the module breaks the vcard creation.
Thanks
Comment #6
michaelpporter commentedThanks, I will look in to it.
Comment #7
michaelpporter commentedPatch to add update hook
Comment #8
cirrus3d commentedLookg good to me - I can't test it right now but I will as soon as I can. Sorry for breaking stuff people :)
Comment #9
mattew commentedWrong name for the hook... should be vcardfield_
field_update_7001, I'm right?Comment #10
michaelpporter commentedYou are right; working to quickly.
Comment #11
mattew commentedI continue to have the same SQL errors. Maybe the update script should update existing vcard fields instances also, or something like that, no?
Comment #12
michaelpporter commentedIt should update all vcards. I wonder if it did not fire because the version number is the same with the patch. When you ran update.php did you see anything about vcardfield?
Comment #13
mattew commentedWhen i ran updb, I seen the update, it seems to have been processed.
The first patch did not triggered update, as the hook was not properly named.
Comment #14
mattew commentedMy errors again :
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_address_vcard_photo' in 'field list': (...) in field_sql_storage_field_storage_write() (line 494 of (...)\modules\field\modules\field_sql_storage\field_sql_storage.module).Exception: exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_address_vcard_photo' in 'field list'' in (...)\includes\database\database.inc:2171 Stack trace: (...)Comment #15
michaelpporter commentedI had to rework the update, there is no direct update for field schemas.
Comment #17
mattew commentedHi,
I tried to restore my database two times, at the same state as my production environment, and I get another error now :
Notice : Undefined index: photo dans template_preprocess_vcardfield() (ligne 306 dans (...)\sites\all\modules\contrib\vcardfield\vcardfield.module).(No more database error)
I get this error several times on each page load (even if no vcard is displayed).
It start to be a problem. Maybe you should revert this "photo" field feature until migration from older version work perfectly. No?
I can't use this version of the module and I need to deploy #2453775 fixe. I think I will revert to a previous version.
Thanks
Comment #19
michaelpporter commentedPlease try 7.15, if that does not fix it I will revert until I can test more.
Comment #20
mattew commentedNow I have two errors when I download a vcard
Sorry but I don't understand why you commit and release a version which you have not properly tested. That's definitely not professional... Non-stable code should not be released as "Recommended".
And you should properly comment your hook_updates, it should not looks like this :
Thanks
Comment #21
michaelpporter commentedTests here have passed. I will add a few more checks in to verify the types of issues you are having.
Comment #23
michaelpporter commentedI made a few adjustments to the code so this works better for updates.
Comment #24
mattew commentedSorry, I don't have more time to spend on this, I revert on 1.10 and will not update this module anymore.
Comment #25
michaelpporter commentedDid you test 7.16? I ran it through many tests here and the errors are gone and middle name is populating.
Comment #26
mattew commentedEach time I test your code I have to restore a database backup to work from production data, and it takes time, I've done this several times since 2 days and I'm fed up, maybe I will try later... sorry.
Comment #27
michaelpporter commentedUnderstand, I'm just saying that I trust 7.16 the others were rushed and I know rushed code is bad code. I should not have released until I had time to test as well.
Comment #28
michaelpporter commentedComment #29
michaelpporter commented