get cover without session login?

Need help? Post your questions here.

Moderator: moderators

get cover without session login?

Postby alpinist » Thu Mar 26, 2009 1:46 pm

Hi,

is there a possibility to get the covers by a single URL without having to start a session? I'm looking for the same mechanism like streaming audio files.

Thats working pretty good for streaming audio:
Code: Select all
http://localhost:12345/stream?u=usr&p=pwd&player=2&pathUtf8Hex=<hex>&suffix=.mp3


But the same thing for covers doesn't:
Code: Select all
http://localhost:12345/coverArt.view?u=usr&p=pwd&size=500&pathUtf8Hex=<hex>


Am I missing something or does coverArt.view does not support usr/pwd via URL?

Thanks!
alpinist
 
Posts: 6
Joined: Thu Mar 26, 2009 1:38 pm

Postby alpinist » Mon Mar 30, 2009 9:56 am

nobody any idea? I'm sure it's possible...
alpinist
 
Posts: 6
Joined: Thu Mar 26, 2009 1:38 pm

Postby alpinist » Wed Apr 01, 2009 6:45 pm

Hi,

since I'm talking to myself, I scripted a workaround, which might be interessting for others. It's just a simple php script, which passes through the cover jpg's. And yes it's simple, so it's just doing that ;-)

http://whereeverthisscriptis/scriptname.php?size=<int>get=<hex>
<int> = pixel sive you want it to resize (poor qualit<, but better than no cover)
<hex> = hex coded local path to the cover.jpg
Code: Select all
<?php

$get = $_GET['get'];
if ( !$get )
  die("no file to get!");

$size = $_GET['size'];
if ( !$size )
  die("dont know which size!");

header('Content-Type: image/jpeg');

if ( !file_exists("cache/cover_".$get.".jpg") )
{
  $tmp = file_get_contents(hex2bin($get));
  file_put_contents( "cache/cover_".$get.".jpg", $tmp );
}
 
$im = ImageCreateTrueColor($size,$size);
$cover = imagecreatefromjpeg("cache/cover_".$get.".jpg");
imagecopyresized( $im, $cover, 0, 0, 0, 0, $size, $size, imagesx($cover), imagesy($cover) );
imagejpeg($im);

function hex2bin($h)
{
  if (!is_string($h))
    return null;
 
  $r='';
  for ($a=0; $a<strlen($h); $a+=2)
    $r.=chr(hexdec($h{$a}.$h{($a+1)}));
 
  return $r;
}

//now it's time for a beer and listen to some music

?>


But maybe the master of this really cool tool will do somthing about the initial problem ;-)
alpinist
 
Posts: 6
Joined: Thu Mar 26, 2009 1:38 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 25 guests