Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • CiviCRM Core CiviCRM Core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,466
    • Issues 1,466
    • List
    • Boards
    • Service Desk
    • Milestones
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • CiviCRM CoreCiviCRM Core
  • Issues
  • #2755
Closed
Open
Created Aug 13, 2021 by colemanw@colemanwOwner

Proposal: add `civicrm_contact.image_file_id` column

Problem

Handling of contact images is nonstandard and difficult to work with.

Current Behavior

Uploading a contact image will:

  1. Store the file in (by default) civicrm/custom.
  2. Update the civicrm_contact.image_URL column with a link to an ajax callback for accessing the image.
  3. Not create a record in the civicrm_file table.
  4. Not create a record in the civicrm_entity_file table.

Deleting a contact image in the UI will:

  1. Not delete the file.
  2. Set civicrm_contact.image_URL to null.

Proposed New Behavior

Add a civicrm_contact.image_file_id column, FK to civicrm_file.id.

Uploading a contact image will:

  1. Store the file as before.
  2. Update the civicrm_contact.image_URL column as before.
  3. Create a record in the civicrm_file table.
  4. Store the file id in the civicrm_contact.image_file_id column
  5. Undecided: should an entry also be created in civicrm_entity_file? See #2760

Deleting a contact image in the UI will:

  1. Delete the file if an id is present in image_file_id column.
  2. Set civicrm_contact.image_URL and civicrm_contact.image_file_id to null.

See PR https://github.com/civicrm/civicrm-core/pull/21141

Edited Aug 16, 2021 by colemanw
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking