aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2015-10-29 11:30:45 +0100
committerMario Vavti <mario@mariovavti.com>2015-10-29 11:30:45 +0100
commit98fd919647a0eb86131eb3863719dfd75ec700a7 (patch)
treefe557eb085eea5708ac45f1dcdc7e35b736ccae2
parente0a75f68d58d3c0074100ad342ecb889b88840dd (diff)
downloadvolse-hubzilla-98fd919647a0eb86131eb3863719dfd75ec700a7.tar.gz
volse-hubzilla-98fd919647a0eb86131eb3863719dfd75ec700a7.tar.bz2
volse-hubzilla-98fd919647a0eb86131eb3863719dfd75ec700a7.zip
possibly better fix for profile photo image type issue
-rw-r--r--include/photo/photo_driver.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index bbcc110c8..11e4c8af3 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -593,15 +593,24 @@ function import_profile_photo($photo,$xchan,$thing = false) {
if($photo) {
$filename = basename($photo);
- $type = guess_image_type($photo);
-
- if(! $type)
- $type = 'image/jpeg';
$result = z_fetch_url($photo,true);
- if($result['success'])
+ if($result['success']) {
$img_str = $result['body'];
+
+ $h = explode("\n",$result['header']);
+ if($h) {
+ foreach($h as $hl) {
+ if(stristr($hl,'content-type:')) {
+ if(! stristr($hl,'image/')) {
+ $photo_failure = true;
+ }
+ }
+ }
+ }
+ $type = guess_image_type($photo, $result['header']);
+ }
}
$img = photo_factory($img_str, $type);