mirror of
https://github.com/friendica/friendica
synced 2025-05-03 13:44:10 +02:00
Issue 6477: Use the correct content-type to resize the images
This commit is contained in:
parent
f0849b0a93
commit
14c28868eb
2 changed files with 10 additions and 8 deletions
|
@ -414,7 +414,9 @@ class Photo extends BaseObject
|
|||
|
||||
$filename = basename($image_url);
|
||||
if (!empty($image_url)) {
|
||||
$img_str = Network::fetchUrl($image_url, true);
|
||||
$ret = Network::curl($image_url, true);
|
||||
$img_str = $ret->getBody();
|
||||
$type = $ret->getContentType();
|
||||
} else {
|
||||
$img_str = '';
|
||||
}
|
||||
|
@ -423,7 +425,10 @@ class Photo extends BaseObject
|
|||
return false;
|
||||
}
|
||||
|
||||
$type = Image::guessType($image_url, true);
|
||||
if (empty($type)) {
|
||||
$type = Image::guessType($image_url, true);
|
||||
}
|
||||
|
||||
$Image = new Image($img_str, $type);
|
||||
if ($Image->isValid()) {
|
||||
$Image->scaleToSquare(300);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue