mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-07 15:54:26 +02:00
add micro profile photo
This commit is contained in:
parent
71ae08d506
commit
b94cb8d234
12 changed files with 77 additions and 13 deletions
30
update.php
30
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`");
|
||||
}
|
||||
}
|
||||
|
||||
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']));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue