1
0
Fork 0

The community page is speeded up.

Photos will be compressed before the output.
This commit is contained in:
Michael Vogel 2013-02-06 08:01:46 +01:00
parent c9307eb96a
commit 5e077e541a
2 changed files with 10 additions and 9 deletions

View file

@ -64,7 +64,8 @@ function community_content(&$a, $update = 0) {
} }
$r = q("SELECT distinct(`item`.`uri`), `item`.*, `item`.`id` AS `item_id`, //$r = q("SELECT distinct(`item`.`uri`)
$r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
@ -75,13 +76,13 @@ function community_content(&$a, $update = 0) {
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `user`.`hidewall` = 0 AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `user`.`hidewall` = 0
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self`
ORDER BY `received` DESC LIMIT %d, %d ", ORDER BY `received` DESC LIMIT %d, %d ",
intval($a->pager['start']), intval($a->pager['start']),
intval($a->pager['itemspage']) intval($a->pager['itemspage'])
); );
// AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 group by `item`.`uri` // group by `item`.`uri`
if(! count($r)) { if(! count($r)) {
info( t('No results.') . EOL); info( t('No results.') . EOL);

View file

@ -106,7 +106,7 @@ function photo_init(&$a) {
intval($resolution) intval($resolution)
); );
if(count($r)) { if(count($r)) {
$sql_extra = permissions_sql($r[0]['uid']); $sql_extra = permissions_sql($r[0]['uid']);
// Now we'll see if we can access the photo // Now we'll see if we can access the photo
@ -169,13 +169,13 @@ function photo_init(&$a) {
} }
} }
if(isset($customres) && $customres > 0 && $customres < 500) { $ph = new Photo($data, $mimetype);
$ph = new Photo($data, $mimetype); if($ph->is_valid()) {
if($ph->is_valid()) { if(isset($customres) && $customres > 0 && $customres < 500) {
$ph->scaleImageSquare($customres); $ph->scaleImageSquare($customres);
$data = $ph->imageString();
$mimetype = $ph->getType();
} }
$data = $ph->imageString();
$mimetype = $ph->getType();
} }
if(function_exists('header_remove')) { if(function_exists('header_remove')) {