summaryrefslogtreecommitdiffstats
path: root/lib/album.lib.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-12-28 22:56:55 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-12-28 22:56:55 +0000
commitd6e28b752f3f04e418a4c27f37fa67b76596d5ec (patch)
tree7425e8a886db303672c97ccebc3d145bf5fa8b5d /lib/album.lib.php
parent223143ed3a95ad59ff2945f6746da73992012354 (diff)
downloadampache-d6e28b752f3f04e418a4c27f37fa67b76596d5ec.tar.gz
ampache-d6e28b752f3f04e418a4c27f37fa67b76596d5ec.tar.bz2
ampache-d6e28b752f3f04e418a4c27f37fa67b76596d5ec.zip
* Added new Snoopy, fixes some minor bugs
* Rewrote Album Art collection, fixing tons of logic flaws, single album art find is currently broken might even be a little faster now when using folder and id3 methods at the same time * Fixed some issues with FastCGI installs * Removed another upload file that wasn't used anymore * Tweaked Recently Played to show 'played XXX ago'
Diffstat (limited to 'lib/album.lib.php')
-rw-r--r--lib/album.lib.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/album.lib.php b/lib/album.lib.php
index fc030163..891c1b24 100644
--- a/lib/album.lib.php
+++ b/lib/album.lib.php
@@ -24,6 +24,39 @@ function get_albums($sql, $action=0) {
} // get_albums
+/**
+ * get_image_from_source
+ * This gets an image for the album art from a source as
+ * defined in the passed array. Because we don't know where
+ * its comming from we are a passed an array that can look like
+ * ['url'] = URL *** OPTIONAL ***
+ * ['file'] = FILENAME *** OPTIONAL ***
+ * ['raw'] = Actual Image data, already captured
+ */
+function get_image_from_source($data) {
+
+ // Already have the data, this often comes from id3tags
+ if (isset($data['raw'])) {
+ return $data['raw'];
+ }
+
+ // Check to see if it's a URL
+ if (isset($data['url'])) {
+ $snoopy = new Snoopy();
+ $snoopy->fetch($results['url']);
+ return $snoopy->results;
+ }
+
+ // Check to see if it's a FILE
+ if (isset($data['file'])) {
+ $handle = fopen($data['file'],'rb');
+ $image_data = fread($handle,filesize($data['file']));
+ fclose($handle);
+ return $image_data;
+ }
+
+ return false;
+} // get_image_from_source
?>