mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:55:15 +00:00
Change the default cover photo and the default_cover_photo logic.
This commit is contained in:
parent
80ee930617
commit
2cf3f9ed9d
13 changed files with 24 additions and 10 deletions
|
@ -2435,6 +2435,7 @@ class Activity
|
||||||
|
|
||||||
if ($cover_photo) {
|
if ($cover_photo) {
|
||||||
set_xconfig($url, 'system', 'cover_photo', $cover_photo);
|
set_xconfig($url, 'system', 'cover_photo', $cover_photo);
|
||||||
|
import_remote_cover_photo($url, $xchan_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1931,8 +1931,7 @@ class Channel
|
||||||
$cover = $r[0];
|
$cover = $r[0];
|
||||||
$cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
|
$cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
|
||||||
} else {
|
} else {
|
||||||
$default_cover = get_config('system', 'default_cover_photo', 'pexels-94622');
|
$cover = [ 'href' => z_root() . '/' . get_default_cover_photo($cover_width) ];
|
||||||
$cover = [ 'href' => z_root() . '/images/default_cover_photos/' . $default_cover . '/' . $cover_width . '.jpg' ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$o .= replace_macros(Theme::get_template('zcard.tpl'), array(
|
$o .= replace_macros(Theme::get_template('zcard.tpl'), array(
|
||||||
|
@ -2004,8 +2003,7 @@ class Channel
|
||||||
$cover = $r[0];
|
$cover = $r[0];
|
||||||
$cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
|
$cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
|
||||||
} else {
|
} else {
|
||||||
$default_cover = get_config('system', 'default_cover_photo', 'pexels-94622');
|
$cover = [ 'href' => z_root() . '/' . get_default_cover_photo($cover_width) ];
|
||||||
$cover = [ 'href' => z_root() . '/images/default_cover_photos/' . $default_cover . '/' . $cover_width . '.jpg' ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$o .= replace_macros(Theme::get_template('zcard_embed.tpl'), array(
|
$o .= replace_macros(Theme::get_template('zcard_embed.tpl'), array(
|
||||||
|
|
|
@ -849,6 +849,7 @@ class Libzot
|
||||||
|
|
||||||
if (isset($arr['cover_photo']) && isset($arr['cover_photo']['url']) && strlen($arr['cover_photo']['url'])) {
|
if (isset($arr['cover_photo']) && isset($arr['cover_photo']['url']) && strlen($arr['cover_photo']['url'])) {
|
||||||
set_xconfig($xchan_hash, 'system', 'cover_photo', $arr['cover_photo']['url']);
|
set_xconfig($xchan_hash, 'system', 'cover_photo', $arr['cover_photo']['url']);
|
||||||
|
import_remote_cover_photo($arr['cover_photo']['url'], $xchan_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($arr['signing_algorithm']) && strlen($arr['signing_algorithm'])) {
|
if (isset($arr['signing_algorithm']) && strlen($arr['signing_algorithm'])) {
|
||||||
|
@ -939,6 +940,7 @@ class Libzot
|
||||||
|
|
||||||
if (isset($arr['cover_photo']) && isset($arr['cover_photo']['url']) && strlen($arr['cover_photo']['url'])) {
|
if (isset($arr['cover_photo']) && isset($arr['cover_photo']['url']) && strlen($arr['cover_photo']['url'])) {
|
||||||
set_xconfig($xchan_hash, 'system', 'cover_photo', $arr['cover_photo']['url']);
|
set_xconfig($xchan_hash, 'system', 'cover_photo', $arr['cover_photo']['url']);
|
||||||
|
import_remote_cover_photo($arr['cover_photo']['url'], $xchan_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($import_photos) {
|
if ($import_photos) {
|
||||||
|
|
|
@ -127,7 +127,9 @@ class Directory extends Controller
|
||||||
|
|
||||||
$safe_mode = Libzotdir::get_directory_setting($observer, 'safemode');
|
$safe_mode = Libzotdir::get_directory_setting($observer, 'safemode');
|
||||||
|
|
||||||
if (Config::Get('system','remote_cover_photos')) {
|
// replace with system.remote_cover_photos once work on this feature is complete
|
||||||
|
|
||||||
|
if (Config::Get('system','remote_cover_photos_directory')) {
|
||||||
$covers = Libzotdir::get_directory_setting($observer, 'covers');
|
$covers = Libzotdir::get_directory_setting($observer, 'covers');
|
||||||
} else {
|
} else {
|
||||||
$covers = false;
|
$covers = false;
|
||||||
|
|
|
@ -27,6 +27,9 @@ class Xp extends Controller
|
||||||
case '6':
|
case '6':
|
||||||
$path = Channel::get_default_profile_photo(48);
|
$path = Channel::get_default_profile_photo(48);
|
||||||
break;
|
break;
|
||||||
|
case '8':
|
||||||
|
$path = Channel::get_default_cover_photo(850);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
8
boot.php
8
boot.php
|
@ -637,6 +637,9 @@ function sys_boot() {
|
||||||
define( 'DEFAULT_NOTIFY_ICON', '/images/z1-64.png' );
|
define( 'DEFAULT_NOTIFY_ICON', '/images/z1-64.png' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! defined('DEFAULT_COVER_PHOTO')) {
|
||||||
|
define('DEFAULT_COVER_PHOTO','pexels-7599590');
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to open the database;
|
* Try to open the database;
|
||||||
|
@ -2585,3 +2588,8 @@ function get_loadtime($module) {
|
||||||
return datetime_convert();
|
return datetime_convert();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_default_cover_photo($size) {
|
||||||
|
$default_cover = get_config('system', 'default_cover_photo', DEFAULT_COVER_PHOTO);
|
||||||
|
return 'images/default_cover_photos/' . $default_cover . '/' . $size . '.jpg';
|
||||||
|
}
|
||||||
|
|
BIN
images/default_cover_photos/pexels-7599590/1200.jpg
Normal file
BIN
images/default_cover_photos/pexels-7599590/1200.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
BIN
images/default_cover_photos/pexels-7599590/425.jpg
Normal file
BIN
images/default_cover_photos/pexels-7599590/425.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
images/default_cover_photos/pexels-7599590/850.jpg
Normal file
BIN
images/default_cover_photos/pexels-7599590/850.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
Binary file not shown.
Before Width: | Height: | Size: 188 KiB |
Binary file not shown.
Before Width: | Height: | Size: 35 KiB |
Binary file not shown.
Before Width: | Height: | Size: 105 KiB |
|
@ -355,16 +355,16 @@ function import_remote_cover_photo($src, $xchan)
|
||||||
if ($result['success']) {
|
if ($result['success']) {
|
||||||
$info = getimagesize($orig);
|
$info = getimagesize($orig);
|
||||||
if (!$info) {
|
if (!$info) {
|
||||||
logger('storage failed.');
|
unlink($orig);
|
||||||
|
logger('storage failure: unrecognisable photo.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$type = $info['mime'];
|
|
||||||
$imagick_path = Config::Get('system','imagick_convert_path');
|
$imagick_path = Config::Get('system','imagick_convert_path');
|
||||||
if ($imagick_path && file_exists($imagick_path)) {
|
if ($imagick_path && file_exists($imagick_path)) {
|
||||||
exec($imagick_path . ' '
|
exec($imagick_path . ' '
|
||||||
. escapeshellarg(PROJECT_BASE . '/' . $orig)
|
. escapeshellarg(PROJECT_BASE . '/' . $orig)
|
||||||
. ' -resize 425x139 '
|
. ' -resize 850x478 '
|
||||||
. escapeshellarg(PROJECT_BASE . '/' . $path . '-9')
|
. escapeshellarg(PROJECT_BASE . '/' . $path . '-8')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue