php 默认情况下 Soundcloud 500x500 图稿
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16549015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Soundcloud 500x500 artwork by default
提问by Black Dahlia
if($song->artwork_url != null) {
$song_artwork = $song->artwork_url;
}
else {
$song_artwork = 'img/no_art.png';
}
By default soundcloud pulls -large
(which is 100x100)
默认情况下,soundcloud 会拉取-large
(即 100x100)
How do i make it pull (t500x500) so i can have a higher res image?
我如何使它拉动(t500x500)以便我可以获得更高的分辨率图像?
回答by likeitlikeit
Just replace large.jpg
by t500x500.jpg
in the filename, like so:
只需在文件名中替换large.jpg
为t500x500.jpg
,如下所示:
$song_artwork = str_replace('large.jpg', 't500x500.jpg', $song->artwork_url);
In fact, they support a number of different formats for different requests:
事实上,它们支持针对不同请求的多种不同格式:
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
I found the documentation in the Soundcloud API reference, search for artwork_url
.
我在Soundcloud API 参考中找到了文档,搜索artwork_url
.
回答by ryan hickman
For client side a simple JS .replace()
will do the job
对于客户端,一个简单的 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');
});
回答by Mark Tickner
@likeitlikeit's answer worked for me, however I had to change the file extension for the 'original' size to png even though the smaller images were jpg, so try that if your first attempt is not found
@likeitlikeit 的答案对我有用,但是即使较小的图像是 jpg,我也必须将“原始”大小的文件扩展名更改为 png,因此如果未找到您的第一次尝试,请尝试