aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/Libzot.php5
-rw-r--r--include/photo/photo_driver.php11
2 files changed, 14 insertions, 2 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 150a6af03..ee1f54ec8 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -795,7 +795,10 @@ class Libzot {
dbesc($xchan_hash)
);
if ($local) {
- $ph = z_fetch_url($arr['photo']['url'], true);
+
+ $ph = false;
+ if (strpos($arr['photo']['url'], z_root()) === false)
+ $ph = z_fetch_url($arr['photo']['url'], true);
if ($ph['success']) {
$hash = import_channel_photo($ph['body'], $arr['photo']['type'], $local[0]['channel_account_id'], $local[0]['channel_id']);
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index f61919eea..1ce2fd6e3 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -401,8 +401,17 @@ function import_channel_photo($photo, $type, $aid, $uid) {
logger('Importing channel photo for ' . $uid, LOGGER_DEBUG);
+ $r = q("SELECT resource_id FROM photo WHERE uid = %d AND photo_usage = %d AND imgscale = %d",
+ intval($uid),
+ intval(PHOTO_PROFILE),
+ intval(PHOTO_RES_PROFILE_300)
+ );
+ if ($r)
+ $hash = $r[0]['resource_id'];
+ else
+ $hash = photo_new_resource();
+
$photo_failure = false;
- $hash = photo_new_resource();
$filename = $hash;
$img = photo_factory($photo, $type);