diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-06-02 22:32:50 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-06-02 22:32:50 -0400 |
commit | b93e398674b375a3b14718fc6dd2a815aad9b387 (patch) | |
tree | 7c2a8097e1c90a87cc8207b5fe08a064f4fa3ae8 /Zotlabs/Module/Profile_photo.php | |
parent | b70c6809648bb3c78e5e26f9293727b3a7aa4025 (diff) | |
parent | f9075e2a2feca0f37fdf568be6e6e53460aa9034 (diff) | |
download | volse-hubzilla-b93e398674b375a3b14718fc6dd2a815aad9b387.tar.gz volse-hubzilla-b93e398674b375a3b14718fc6dd2a815aad9b387.tar.bz2 volse-hubzilla-b93e398674b375a3b14718fc6dd2a815aad9b387.zip |
Merge remote-tracking branch 'upstream/dev' into wiki
Diffstat (limited to 'Zotlabs/Module/Profile_photo.php')
-rw-r--r-- | Zotlabs/Module/Profile_photo.php | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index a8cf3cbee..6129a7492 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -93,7 +93,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { $srcW = $_POST['xfinal'] - $srcX; $srcH = $_POST['yfinal'] - $srcY; - $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND uid = %d AND scale = %d LIMIT 1", + $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND uid = %d AND imgscale = %d LIMIT 1", dbesc($image_id), dbesc(local_channel()), intval($scale)); @@ -101,9 +101,9 @@ class Profile_photo extends \Zotlabs\Web\Controller { if($r) { $base_image = $r[0]; - $base_image['data'] = (($r[0]['os_storage']) ? @file_get_contents($base_image['data']) : dbunescbin($base_image['data'])); + $base_image['content'] = (($r[0]['os_storage']) ? @file_get_contents($base_image['content']) : dbunescbin($base_image['content'])); - $im = photo_factory($base_image['data'], $base_image['type']); + $im = photo_factory($base_image['content'], $base_image['mimetype']); if($im->is_valid()) { $im->cropImage(300,$srcX,$srcY,$srcW,$srcH); @@ -113,25 +113,25 @@ class Profile_photo extends \Zotlabs\Web\Controller { $p = array('aid' => $aid, 'uid' => local_channel(), 'resource_id' => $base_image['resource_id'], 'filename' => $base_image['filename'], 'album' => t('Profile Photos')); - $p['scale'] = 4; + $p['imgscale'] = 4; $p['photo_usage'] = (($is_default_profile) ? PHOTO_PROFILE : PHOTO_NORMAL); $r1 = $im->save($p); $im->scaleImage(80); - $p['scale'] = 5; + $p['imgscale'] = 5; $r2 = $im->save($p); $im->scaleImage(48); - $p['scale'] = 6; + $p['imgscale'] = 6; $r3 = $im->save($p); if($r1 === false || $r2 === false || $r3 === false) { // if one failed, delete them all so we can start over. notice( t('Image resize failed.') . EOL ); - $x = q("delete from photo where resource_id = '%s' and uid = %d and scale >= 4 ", + $x = q("delete from photo where resource_id = '%s' and uid = %d and imgscale >= 4 ", dbesc($base_image['resource_id']), local_channel() ); @@ -208,7 +208,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { logger('attach_store: ' . print_r($res,true)); if($res && intval($res['data']['is_photo'])) { - $i = q("select * from photo where resource_id = '%s' and uid = %d order by scale", + $i = q("select * from photo where resource_id = '%s' and uid = %d order by imgscale", dbesc($hash), intval(local_channel()) ); @@ -220,11 +220,11 @@ class Profile_photo extends \Zotlabs\Web\Controller { $os_storage = false; foreach($i as $ii) { - if(intval($ii['scale']) < 2) { - $smallest = intval($ii['scale']); + if(intval($ii['imgscale']) < 2) { + $smallest = intval($ii['imgscale']); $os_storage = intval($ii['os_storage']); - $imagedata = $ii['data']; - $filetype = $ii['type']; + $imagedata = $ii['content']; + $filetype = $ii['mimetype']; } } } @@ -250,7 +250,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { */ - function get() { + function get() { if(! local_channel()) { notice( t('Permission denied.') . EOL ); @@ -275,7 +275,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { $resource_id = argv(2); - $r = q("SELECT id, album, scale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY scale ASC", + $r = q("SELECT id, album, imgscale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY imgscale ASC", intval(local_channel()), dbesc($resource_id) ); @@ -285,7 +285,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { } $havescale = false; foreach($r as $rr) { - if($rr['scale'] == 5) + if($rr['imgscale'] == 5) $havescale = true; } @@ -315,7 +315,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { goaway(z_root() . '/profiles'); } - $r = q("SELECT `data`, `type`, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1", + $r = q("SELECT content, mimetype, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1", intval($r[0]['id']), intval(local_channel()) @@ -326,15 +326,15 @@ class Profile_photo extends \Zotlabs\Web\Controller { } if(intval($r[0]['os_storage'])) - $data = @file_get_contents($r[0]['data']); + $data = @file_get_contents($r[0]['content']); else - $data = dbunescbin($r[0]['data']); + $data = dbunescbin($r[0]['content']); - $ph = photo_factory($data, $r[0]['type']); + $ph = photo_factory($data, $r[0]['mimetype']); $smallest = 0; if($ph->is_valid()) { // go ahead as if we have just uploaded a new photo to crop - $i = q("select resource_id, scale from photo where resource_id = '%s' and uid = %d order by scale", + $i = q("select resource_id, imgscale from photo where resource_id = '%s' and uid = %d order by imgscale", dbesc($r[0]['resource_id']), intval(local_channel()) ); @@ -342,8 +342,8 @@ class Profile_photo extends \Zotlabs\Web\Controller { if($i) { $hash = $i[0]['resource_id']; foreach($i as $ii) { - if(intval($ii['scale']) < 2) { - $smallest = intval($ii['scale']); + if(intval($ii['imgscale']) < 2) { + $smallest = intval($ii['imgscale']); } } } |