用t500x500.jpg替换Large.jpg

时间:2016-05-20 14:13:44

标签: php

目前我正在搞乱SoundClouds API,我正在尝试这样做,以便当我使用以下代码完成艺术作品时。

<div class="artwork_url">
<a href="'.$content[$x]['artwork_url'].'" style="text-decoration: none; color: #365899;">View Image</a>
</div>

它将返回link to desired format,但它会返回与此link to image giving me problems类似的内容。

非常感谢任何帮助。 如果您需要参考,这里是SoundClouds API的链接。

1 个答案:

答案 0 :(得分:4)

根据文档The URL is pointing to the format large by default. If you want to use a different format you have to replace large with the specific format name in the image URL:

这应该有效:

<强> PHP

str_replace('large', 't500x500', $content[$x]['artwork_url'])

<强> HTML

<div class="artwork_url">
  <a href="'.str_replace('large', 't500x500', $content[$x]['artwork_url']).'" style="text-decoration: none;      color: #365899;">View Image</a>
</div>
相关问题