aboutsummaryrefslogtreecommitdiffstats
path: root/include/photo/photo_driver.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-09-16 01:06:44 -0700
committerzotlabs <mike@macgirvin.com>2017-09-16 01:06:44 -0700
commit991db806466d114b4ec179af9930e859bb21843b (patch)
treef3d8a5f09ba9c5b36c9bc8e0176b3d11cba732cf /include/photo/photo_driver.php
parentb1876ac14fc4f9b7e39989ef7e69c8135a25c13f (diff)
parentcb3fb0049f64a92668bc94746dc55cc905683699 (diff)
downloadvolse-hubzilla-991db806466d114b4ec179af9930e859bb21843b.tar.gz
volse-hubzilla-991db806466d114b4ec179af9930e859bb21843b.tar.bz2
volse-hubzilla-991db806466d114b4ec179af9930e859bb21843b.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
Diffstat (limited to 'include/photo/photo_driver.php')
-rw-r--r--include/photo/photo_driver.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index 94d0faa94..c6c023147 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -637,6 +637,36 @@ function import_xchan_photo($photo,$xchan,$thing = false) {
}
+function import_channel_photo_from_url($photo,$aid,$uid) {
+
+ if($photo) {
+ $filename = basename($photo);
+
+ $result = z_fetch_url($photo,true);
+
+ if($result['success']) {
+ $img_str = $result['body'];
+ $type = guess_image_type($photo, $result['header']);
+
+ $h = explode("\n",$result['header']);
+ if($h) {
+ foreach($h as $hl) {
+ if(stristr($hl,'content-type:')) {
+ if(! stristr($hl,'image/')) {
+ $photo_failure = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ else {
+ $photo_failure = true;
+ }
+
+ import_channel_photo($img_str,$type,$aid,$uid);
+
+}
function import_channel_photo($photo,$type,$aid,$uid) {