aboutsummaryrefslogtreecommitdiffstats
path: root/include/photo
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-09-14 18:48:55 -0700
committerzotlabs <mike@macgirvin.com>2017-09-14 18:48:55 -0700
commit1c0ece841152ea507e1cbaf031460078c2c22ad8 (patch)
tree09b294984a2ea9e7d48e730ec1d3be3e03ec3426 /include/photo
parentcf120b235117017a81b8a9b1a073919fb1b7d50b (diff)
downloadvolse-hubzilla-1c0ece841152ea507e1cbaf031460078c2c22ad8.tar.gz
volse-hubzilla-1c0ece841152ea507e1cbaf031460078c2c22ad8.tar.bz2
volse-hubzilla-1c0ece841152ea507e1cbaf031460078c2c22ad8.zip
provide a hook for importing a channel photo at channel creation time
Diffstat (limited to 'include/photo')
-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) {