Ritzy
Ritzy

Reputation: 379

Replacing Large.jpg with t500x500.jpg

Currently I am messing around with SoundClouds API, I am trying to make it so that when I pull the art-work using the following code.

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

It will return link to desired format but instead it returns something that looks similar to this link to image giving me problems.

Any help would be very much appreciated. Here's a link to SoundClouds API provided you need reference.

Upvotes: 1

Views: 52

Answers (1)

Sofiene Djebali
Sofiene Djebali

Reputation: 4508

According to the documentation 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:

This should work :

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>

Upvotes: 4

Related Questions