2016-05-20 8 views
1

現在、私はSoundClouds APIを使いこなしています。次のコードを使用してアートワークをプルするときに、そのようにしています。Large.jpgをt500x500.jpgに置き換える

<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

あなたはのvar_dump()を$コンテンツの行うことができます[$ x] pl ? –

+0

'$ content [$ x] ['artwork_url']'は現在何を返していますか?イメージURLの後ろに次元を追加するだけではありませんか? ' haakym

答えて

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> 
+1

私はドキュメントをチェックしました。私は 'large.jpg'または' large.'を置き換える方が安全だと思います。あるいは「大」 – Peon

関連する問題