diff options
author | friendica <info@friendica.com> | 2013-02-19 20:22:04 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-02-19 20:22:04 -0800 |
commit | 23718e5e28a7456b53ac384b5a2a0c3c6a1e99d5 (patch) | |
tree | 04b67526ef9cb342c09983d044429f6a2e63f4f3 /include | |
parent | ef360f0a5ce9b422642a395d1cbd62dac8dda973 (diff) | |
download | volse-hubzilla-23718e5e28a7456b53ac384b5a2a0c3c6a1e99d5.tar.gz volse-hubzilla-23718e5e28a7456b53ac384b5a2a0c3c6a1e99d5.tar.bz2 volse-hubzilla-23718e5e28a7456b53ac384b5a2a0c3c6a1e99d5.zip |
that should be the last critical piece. Everything else is gravy.
Diffstat (limited to 'include')
-rw-r--r-- | include/Photo.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/Photo.php b/include/Photo.php index 6ba973dce..de3d30c39 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -717,3 +717,52 @@ function import_profile_photo($photo,$xchan) { return(array($photo,$thumb,$micro,$type)); } + + + +function import_channel_photo($photo,$type,$aid,$uid) { + + $a = get_app(); + + logger('import_channel_photo: importing channel photo for ' . $uid, LOGGER_DEBUG); + + $hash = photo_new_resource(); + + $photo_failure = false; + + + $filename = $hash; + + $img = new Photo($photo, $type); + if($img->is_valid()) { + + $img->scaleImageSquare(175); + + $r = $img->store($aid,$uid,'', $hash, $filename, t('Profile Photos'), 4, true); + + if($r === false) + $photo_failure = true; + + $img->scaleImage(80); + + $r = $img->store($aid,$uid,'', $hash, $filename, t('Profile Photos'), 5, true); + + if($r === false) + $photo_failure = true; + + $img->scaleImage(48); + + $r = $img->store($aid,$uid,'', $hash, $filename, t('Profile Photos'), 6, true); + + if($r === false) + $photo_failure = true; + + } + else { + logger('import_channel_photo: invalid image.'); + $photo_failure = true; + } + + return(($photo_failure)? false : true); + +} |