possibly better fix for profile photo image type issue
This commit is contained in:
parent
e0a75f68d5
commit
98fd919647
@ -593,15 +593,24 @@ function import_profile_photo($photo,$xchan,$thing = false) {
|
|||||||
|
|
||||||
if($photo) {
|
if($photo) {
|
||||||
$filename = basename($photo);
|
$filename = basename($photo);
|
||||||
$type = guess_image_type($photo);
|
|
||||||
|
|
||||||
if(! $type)
|
|
||||||
$type = 'image/jpeg';
|
|
||||||
|
|
||||||
$result = z_fetch_url($photo,true);
|
$result = z_fetch_url($photo,true);
|
||||||
|
|
||||||
if($result['success'])
|
if($result['success']) {
|
||||||
$img_str = $result['body'];
|
$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);
|
$img = photo_factory($img_str, $type);
|
||||||
|
Reference in New Issue
Block a user