aboutsummaryrefslogtreecommitdiffstats
path: root/update.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2010-11-04 23:50:32 -0700
committerFriendika <info@friendika.com>2010-11-04 23:50:32 -0700
commitb94cb8d234d70bc534ad1cef767b9f62d10eef26 (patch)
tree9e8cf0d529421c7b8d8e389478be8c4b196d11e6 /update.php
parent71ae08d506130e45f68cf4e09d71f3a1c2e2d782 (diff)
downloadvolse-hubzilla-b94cb8d234d70bc534ad1cef767b9f62d10eef26.tar.gz
volse-hubzilla-b94cb8d234d70bc534ad1cef767b9f62d10eef26.tar.bz2
volse-hubzilla-b94cb8d234d70bc534ad1cef767b9f62d10eef26.zip
add micro profile photo
Diffstat (limited to 'update.php')
-rw-r--r--update.php30
1 files changed, 29 insertions, 1 deletions
diff --git a/update.php b/update.php
index 68367343d..dfa54af59 100644
--- a/update.php
+++ b/update.php
@@ -101,4 +101,32 @@ function update_1012() {
function update_1013() {
q("ALTER TABLE `item` ADD `target-type` CHAR( 255 ) NOT NULL
AFTER `object` , ADD `target` TEXT NOT NULL AFTER `target-type`");
-} \ No newline at end of file
+}
+
+function update_1014() {
+ require_once('include/Photo.php');
+ q("ALTER TABLE `contact` ADD `micro` TEXT NOT NULL AFTER `thumb` ");
+ $r = q("SELECT * FROM `photo` WHERE `scale` = 4");
+ if(count($r)) {
+ foreach($r as $rr) {
+ $ph = new Photo($rr['data']);
+ if($ph->is_valid()) {
+ $ph->scaleImage(48);
+ $ph->store($rr['uid'],$rr['contact-id'],$rr['resource-id'],$rr['filename'],$rr['album'],6,(($rr['profile']) ? 1 : 0));
+ }
+ }
+ }
+ $r = q("SELECT * FROM `contact` WHERE 1");
+ if(count($r)) {
+ foreach($r as $rr) {
+ if(stristr($rr['thumb'],'avatar'))
+ q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d LIMIT 1",
+ dbesc(str_replace('avatar','micro',$rr['thumb'])),
+ intval($rr['id']));
+ else
+ q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d LIMIT 1",
+ dbesc(str_replace('5.jpg','6.jpg',$rr['thumb'])),
+ intval($rr['id']));
+ }
+ }
+} \ No newline at end of file