if($song->artwork_url != null) {
$song_artwork = $song->artwork_url;
}
else {
$song_artwork = 'img/no_art.png';
}
默认情况下,soundcloud 拉动-large
(即 100x100)
我如何让它拉(t500x500)所以我可以获得更高分辨率的图像?
if($song->artwork_url != null) {
$song_artwork = $song->artwork_url;
}
else {
$song_artwork = 'img/no_art.png';
}
默认情况下,soundcloud 拉动-large
(即 100x100)
我如何让它拉(t500x500)所以我可以获得更高分辨率的图像?
只需在文件名中替换large.jpg
为t500x500.jpg
,如下所示:
$song_artwork = str_replace('large.jpg', 't500x500.jpg', $song->artwork_url);
事实上,它们为不同的请求支持多种不同的格式:
t500x500: 500px×500px
crop: 400px×400px
t300x300: 300px×300px
large: 100px×100px (default)
t67x67: 67px×67px (only on artworks)
badge: 47px×47px
small: 32px×32px
tiny: 20px×20px (on artworks)
tiny: 18px×18px (on avatars)
mini: 16px×16px
original: originally uploaded image
我在Soundcloud API 参考中找到了文档,搜索artwork_url
.
对于客户端,一个简单的 JS.replace()
就可以完成这项工作
SC.get("/users/984878/tracks", {limit: 10}, function(tracks){
$.each(tracks, function(index,track){
lrgart = track.artwork_url;
lrgart = lrgart.replace('-large', '-t500x500');
});
@likeitlikeit 的答案对我有用,但是即使较小的图像是 jpg,我也必须将“原始”大小的文件扩展名更改为 png,因此如果找不到您的第一次尝试,请尝试