that should be the last critical piece. Everything else is gravy.
This commit is contained in:
parent
ef360f0a5c
commit
23718e5e28
@ -717,3 +717,52 @@ function import_profile_photo($photo,$xchan) {
|
|||||||
return(array($photo,$thumb,$micro,$type));
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -113,10 +113,10 @@ function import_post(&$a) {
|
|||||||
// reset
|
// reset
|
||||||
$channel = $r[0];
|
$channel = $r[0];
|
||||||
|
|
||||||
|
if($data['photo']) {
|
||||||
// FIXME - import the default profile photo (it has now been exported as a base64 blob)
|
require_once('include/Photo.php');
|
||||||
|
import_channel_photo(base64url_decode($data['photo']['data']),$data['photo']['type'],get_account_id,$channel['channel_id']);
|
||||||
|
}
|
||||||
|
|
||||||
$profiles = $data['profile'];
|
$profiles = $data['profile'];
|
||||||
if($profiles) {
|
if($profiles) {
|
||||||
|
Reference in New Issue
Block a user