require_once("include/Photo.php");
-if(! function_exists('profile_photo_init')) {
function profile_photo_init(&$a) {
if(! local_user()) {
}
profile_load($a,$a->user['nickname']);
+
}
-}
-if(! function_exists('profile_photo_post')) {
+
function profile_photo_post(&$a) {
if(! local_user()) {
$filesize = intval($_FILES['userfile']['size']);
$filetype = $_FILES['userfile']['type'];
if ($filetype=="") $filetype=guess_image_type($filename);
-
+
$maximagesize = get_config('system','maximagesize');
if(($maximagesize) && ($filesize > $maximagesize)) {
$ph->orient($src);
@unlink($src);
return profile_photo_crop_ui_head($a, $ph);
-}
+
}
notice( t('Permission denied.') . EOL );
return;
}
-
+
$newuser = false;
if($a->argc == 2 && $a->argv[1] === 'new')
notice( t('Permission denied.') . EOL );
return;
};
-
+
// check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
-
+
$resource_id = $a->argv[2];
//die(":".local_user());
$r=q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' ORDER BY `scale` ASC",
if(! x($a->config,'imagecrop')) {
-
+
$tpl = get_markup_template('profile_photo.tpl');
$o .= replace_macros($tpl,array(
}
$hash = photo_new_resource();
-
+
$smallest = 0;
- $r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 0 );
+ $r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 0 );
if($r)
info( t('Image uploaded successfully.') . EOL );
if($width > 640 || $height > 640) {
$ph->scaleImage(640);
- $r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 1 );
-
+ $r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 1 );
+
if($r === false)
notice( sprintf(t('Image size reduction [%s] failed.'),"640") . EOL );
else
$a->page['end'] .= replace_macros(get_markup_template("cropend.tpl"), array());
return;
}}
+