mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
add cover to torrent
This commit is contained in:
@@ -126,8 +126,7 @@ class Test extends Command
|
||||
// $r = $rep->getContinuousDays($attendance);
|
||||
// $r = $rep->getContinuousPoints(11);
|
||||
|
||||
$today = Carbon::today();
|
||||
$r = $today->endOfMonth();
|
||||
$r = parse_url('https://img9.doubanio.com/view/photo/l_ratio_poster/public/p2867903173.jpg', PHP_URL_SCHEME);
|
||||
dd($r);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,9 +49,17 @@ class TorrentResource extends JsonResource
|
||||
'thanks' => ThankResource::collection($this->whenLoaded('thanks')),
|
||||
'reward_logs' => RewardResource::collection($this->whenLoaded('reward_logs')),
|
||||
];
|
||||
$descriptionArr = format_description($this->descr);
|
||||
$out['cover'] = get_image_from_description($descriptionArr, true);
|
||||
if ($this->cover) {
|
||||
$cover = $this->cover;
|
||||
} else {
|
||||
$descriptionArr = format_description($this->descr);
|
||||
$cover = get_image_from_description($descriptionArr, true);
|
||||
}
|
||||
$out['cover'] = resize_image($cover, 100, 100);
|
||||
if ($request->routeIs('torrents.show')) {
|
||||
if (!isset($descriptionArr)) {
|
||||
$descriptionArr = format_description($this->descr);
|
||||
}
|
||||
$baseInfo = [
|
||||
['label' => nexus_trans('torrent.show.size'), 'value' => mksize($this->size)],
|
||||
];
|
||||
|
||||
@@ -13,7 +13,7 @@ class Torrent extends NexusModel
|
||||
'category', 'source', 'medium', 'codec', 'standard', 'processing', 'team', 'audiocodec',
|
||||
'size', 'added', 'type', 'numfiles', 'owner', 'nfo', 'sp_state', 'promotion_time_type',
|
||||
'promotion_until', 'anonymous', 'url', 'pos_state', 'cache_stamp', 'picktype', 'picktime',
|
||||
'last_reseed', 'pt_gen', 'technical_info', 'leechers', 'seeders',
|
||||
'last_reseed', 'pt_gen', 'technical_info', 'leechers', 'seeders', 'cover',
|
||||
];
|
||||
|
||||
private static $globalPromotionState;
|
||||
@@ -31,7 +31,7 @@ class Torrent extends NexusModel
|
||||
|
||||
public static $commentFields = [
|
||||
'id', 'name', 'added', 'visible', 'banned', 'owner', 'sp_state', 'pos_state', 'hr', 'picktype', 'picktime',
|
||||
'last_action', 'leechers', 'seeders', 'times_completed', 'views', 'size'
|
||||
'last_action', 'leechers', 'seeders', 'times_completed', 'views', 'size', 'cover'
|
||||
];
|
||||
|
||||
public static $basicRelations = [
|
||||
|
||||
Reference in New Issue
Block a user