diff --git a/library/Class/NoticeHtml.php b/library/Class/NoticeHtml.php index c9bf0089412dfea32392019fb931e6d3fbb5d63d..16a1cf512e9188f2f5cb4abe012489e0a529d4ce 100644 --- a/library/Class/NoticeHtml.php +++ b/library/Class/NoticeHtml.php @@ -224,9 +224,9 @@ class Class_NoticeHtml { { if( $num % 4 == 0 and $num>0) $html.='</tr><tr>'; $img = sprintf('<img class="photo" src="%s" title="%s" border="0" onclick="%s" style="cursor:pointer" alt="%s" />', - $photo, + $photo['thumb'], $this->_translate->_("Agrandir l'image"), - "afficher_image('".str_replace("126b","_",$photo)."')", + "afficher_image('" . $photo['full'] . "')", $this->_translate->_("Agrandir l'image")); $html .= '<td class="photo_onglet">'.$img.'</td>'; diff --git a/library/Class/WebService/Lastfm.php b/library/Class/WebService/Lastfm.php index fdc5db688f7a914f7e28dedb5eb914c687f11651..2134108116ca34926e42e620d6db4855adfb39f8 100644 --- a/library/Class/WebService/Lastfm.php +++ b/library/Class/WebService/Lastfm.php @@ -196,7 +196,10 @@ class Class_WebService_Lastfm extends Class_WebService_Abstract { $photos = []; foreach($elements as $element) { - $photos []= str_replace('avatar170s', '770x0', $element->getAttribute('src')); + $url = $element->getAttribute('src'); + + $photos []= ['thumb' => $url, + 'full' => str_replace('avatar170s', '770x0', $url)]; } return $photos; diff --git a/tests/library/Class/WebService/LastfmTest.php b/tests/library/Class/WebService/LastfmTest.php index bc89ed7effb960592e4fbb51d80863b20250ef56..32c6f89d6d96d4ffe1f3103fc89e6b7a2e759942 100644 --- a/tests/library/Class/WebService/LastfmTest.php +++ b/tests/library/Class/WebService/LastfmTest.php @@ -121,7 +121,6 @@ class LastfmGetPhotosRageAgainstTheMachineTest extends ModelTestCase { parent::setUp(); $lastfm = new Class_WebService_Lastfm(); $this->_photos = $lastfm->getPhotos('Rage Against The Machine'); - var_dump($this->_photos); } @@ -134,7 +133,13 @@ class LastfmGetPhotosRageAgainstTheMachineTest extends ModelTestCase { /** @test */ public function firstPhotoShouldBeValidUrl() { $validator = new ZendAfi_Validate_Url(); - $this->assertTrue($validator->isValid($this->_photos[0])); + $this->assertTrue($validator->isValid($this->_photos[0]['thumb'])); + } + + + /** @test */ + public function fullPhotoShouldBeInFolder770x0() { + $this->assertContains('/i/u/770x0/', $this->_photos[0]['full']); } }