diff --git a/Code/Lib/Activity.php b/Code/Lib/Activity.php index cb586c6a4..cd8b4ff88 100644 --- a/Code/Lib/Activity.php +++ b/Code/Lib/Activity.php @@ -2435,6 +2435,7 @@ class Activity if ($cover_photo) { set_xconfig($url, 'system', 'cover_photo', $cover_photo); + import_remote_cover_photo($url, $xchan_hash); } diff --git a/Code/Lib/Channel.php b/Code/Lib/Channel.php index 8278f5318..cec6b3e97 100644 --- a/Code/Lib/Channel.php +++ b/Code/Lib/Channel.php @@ -1931,8 +1931,7 @@ class Channel $cover = $r[0]; $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale']; } else { - $default_cover = get_config('system', 'default_cover_photo', 'pexels-94622'); - $cover = [ 'href' => z_root() . '/images/default_cover_photos/' . $default_cover . '/' . $cover_width . '.jpg' ]; + $cover = [ 'href' => z_root() . '/' . get_default_cover_photo($cover_width) ]; } $o .= replace_macros(Theme::get_template('zcard.tpl'), array( @@ -2004,8 +2003,7 @@ class Channel $cover = $r[0]; $cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale']; } else { - $default_cover = get_config('system', 'default_cover_photo', 'pexels-94622'); - $cover = [ 'href' => z_root() . '/images/default_cover_photos/' . $default_cover . '/' . $cover_width . '.jpg' ]; + $cover = [ 'href' => z_root() . '/' . get_default_cover_photo($cover_width) ]; } $o .= replace_macros(Theme::get_template('zcard_embed.tpl'), array( diff --git a/Code/Lib/Libzot.php b/Code/Lib/Libzot.php index 7a62b1f40..1325517f5 100644 --- a/Code/Lib/Libzot.php +++ b/Code/Lib/Libzot.php @@ -849,6 +849,7 @@ class Libzot 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']); + import_remote_cover_photo($arr['cover_photo']['url'], $xchan_hash); } 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'])) { set_xconfig($xchan_hash, 'system', 'cover_photo', $arr['cover_photo']['url']); + import_remote_cover_photo($arr['cover_photo']['url'], $xchan_hash); } if ($import_photos) { diff --git a/Code/Module/Directory.php b/Code/Module/Directory.php index a7f318a61..8c297f85e 100644 --- a/Code/Module/Directory.php +++ b/Code/Module/Directory.php @@ -127,7 +127,9 @@ class Directory extends Controller $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'); } else { $covers = false; diff --git a/Code/Module/Xp.php b/Code/Module/Xp.php index facaaea14..9bcbff0c9 100644 --- a/Code/Module/Xp.php +++ b/Code/Module/Xp.php @@ -27,6 +27,9 @@ class Xp extends Controller case '6': $path = Channel::get_default_profile_photo(48); break; + case '8': + $path = Channel::get_default_cover_photo(850); + break; default: break; } diff --git a/boot.php b/boot.php index c24cc1fac..4dc92f0cf 100755 --- a/boot.php +++ b/boot.php @@ -637,6 +637,9 @@ function sys_boot() { define( 'DEFAULT_NOTIFY_ICON', '/images/z1-64.png' ); } + if (! defined('DEFAULT_COVER_PHOTO')) { + define('DEFAULT_COVER_PHOTO','pexels-7599590'); + } /* * Try to open the database; @@ -2584,4 +2587,9 @@ function get_loadtime($module) { } return datetime_convert(); -} \ No newline at end of file +} + +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'; +} diff --git a/images/default_cover_photos/pexels-7599590/1200.jpg b/images/default_cover_photos/pexels-7599590/1200.jpg new file mode 100644 index 000000000..8af2e2ee9 Binary files /dev/null and b/images/default_cover_photos/pexels-7599590/1200.jpg differ diff --git a/images/default_cover_photos/pexels-7599590/425.jpg b/images/default_cover_photos/pexels-7599590/425.jpg new file mode 100644 index 000000000..b86aea23e Binary files /dev/null and b/images/default_cover_photos/pexels-7599590/425.jpg differ diff --git a/images/default_cover_photos/pexels-7599590/850.jpg b/images/default_cover_photos/pexels-7599590/850.jpg new file mode 100644 index 000000000..801199195 Binary files /dev/null and b/images/default_cover_photos/pexels-7599590/850.jpg differ diff --git a/images/default_cover_photos/pexels-94622/1200.jpg b/images/default_cover_photos/pexels-94622/1200.jpg deleted file mode 100644 index 509f4f051..000000000 Binary files a/images/default_cover_photos/pexels-94622/1200.jpg and /dev/null differ diff --git a/images/default_cover_photos/pexels-94622/425.jpg b/images/default_cover_photos/pexels-94622/425.jpg deleted file mode 100644 index 02b2fdbee..000000000 Binary files a/images/default_cover_photos/pexels-94622/425.jpg and /dev/null differ diff --git a/images/default_cover_photos/pexels-94622/850.jpg b/images/default_cover_photos/pexels-94622/850.jpg deleted file mode 100644 index 946a7a85b..000000000 Binary files a/images/default_cover_photos/pexels-94622/850.jpg and /dev/null differ diff --git a/include/photo_factory.php b/include/photo_factory.php index f55bfc963..05a1356d9 100644 --- a/include/photo_factory.php +++ b/include/photo_factory.php @@ -355,16 +355,16 @@ function import_remote_cover_photo($src, $xchan) if ($result['success']) { $info = getimagesize($orig); if (!$info) { - logger('storage failed.'); + unlink($orig); + logger('storage failure: unrecognisable photo.'); return false; } - $type = $info['mime']; $imagick_path = Config::Get('system','imagick_convert_path'); if ($imagick_path && file_exists($imagick_path)) { exec($imagick_path . ' ' . escapeshellarg(PROJECT_BASE . '/' . $orig) - . ' -resize 425x139 ' - . escapeshellarg(PROJECT_BASE . '/' . $path . '-9') + . ' -resize 850x478 ' + . escapeshellarg(PROJECT_BASE . '/' . $path . '-8') ); } }