Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/issues/698, send correct MIME type for .jpg files #13544

Merged
merged 2 commits into from
Feb 6, 2019

Conversation

pradpnayak
Copy link
Contributor

@pradpnayak pradpnayak commented Feb 5, 2019

Overview

Content-Type should be image/jpeg, not image/jpg .
https://lab.civicrm.org/dev/core/issues/698

Technical Details

IE doesn't support MIME type image/jpg

@civibot
Copy link

civibot bot commented Feb 5, 2019

(Standard links)

@civibot civibot bot added the master label Feb 5, 2019
@colemanw
Copy link
Member

colemanw commented Feb 5, 2019

According to this document, there are two other extensions that would need translating. So the map would be:

[
  'tif' => 'image/tiff',
  'jpg' => 'image/jpeg',
  'svg' => 'image/svg+xml',
]

@pradpnayak
Copy link
Contributor Author

@colemanw, Thank you so much for pointing the missing ones.

I have pushed the change for you to review.

Cheers
Pradeep

if (!empty($translateMimeTypes[$fileExtension])) {
$fileExtension = $translateMimeTypes[$fileExtension];
}
$mimeType = 'image/' . $fileExtension;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these 4 lines can be shortened to:

$mimeType = 'image/' . CRM_Utils_Array::value($fileExtension, $translateMimeTypes, $fileExtension);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@colemanw done!

@colemanw colemanw merged commit e78c738 into civicrm:master Feb 6, 2019
@pradpnayak pradpnayak deleted the ContactImage branch March 23, 2020 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants