<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -20,7 +20,8 @@ SpazImageURL.prototype.initAPIs = function() {
 			return url;
 		},
 		'getImageUrl'     : function(id) {
-			return null;
+			var url = 'http://twitpic.com/show/large/'+id;
+			return url;
 		}
 	});
 
@@ -32,7 +33,8 @@ SpazImageURL.prototype.initAPIs = function() {
 			return url;
 		},
 		'getImageUrl'     : function(id) {
-			return null;
+			var url = 'http://yfrog.com/'+id+':iphone';
+			return url;
 		}
 	});
 	
@@ -52,10 +54,10 @@ SpazImageURL.prototype.initAPIs = function() {
 	
 	
 	this.addAPI('pikchur', {
-		'url_regex'       : /http:\/\/pikchur.com\/([a-zA-Z0-9]+)/gi,
+		'url_regex'       : /http:\/\/(?:pikchur\.com|pk\.gd)\/([a-zA-Z0-9]+)/gi,
 		'getThumbnailUrl' : function(id) {
 			// http://img.pikchur.com/pic_GPT_t.jpg
-			var url = 'http://img.pikchur.com/pic_'+id+'_t.jpg';
+			var url = 'http://img.pikchur.com/pic_'+id+'_m.jpg';
 			return url;
 		},
 		'getImageUrl'     : function(id) {
@@ -144,13 +146,16 @@ SpazImageURL.prototype.findServiceUrlsInString = function(str) {
 	for (key in this.apis) {
 		
 		thisapi = this.getAPI(key);
-		
+		sch.dump(key);
+		sch.dump(thisapi.url_regex);
 		while( (re_matches = thisapi.url_regex.exec(sch.trim(str))) != null) {
+			sch.dump(re_matches);
 			matches[key] = re_matches;
 			num_matches++;
 		}
 	}
-	
+	sch.dump('num_matches:'+num_matches);
+	sch.dump(matches);	
 	if (num_matches &gt; 0) {
 		return matches;
 	} else {
@@ -168,12 +173,16 @@ SpazImageURL.prototype.getThumbsForMatches = function(matches) {
 	var x, service, api, thumburl, thumburls = {}, num_urls = 0;
 	
 	for (service in matches) {
+		sch.dump('SERVICE:'+service);
 		api = this.getAPI(service);
 		urls = matches[service]; // an array
-		
+		sch.dump(&quot;URLS:&quot;+urls);
 		thumburls[urls[0]] = api.getThumbnailUrl(urls[1]);
 		num_urls++;
 	}
+
+	sch.dump('num_urls:'+num_urls);
+	sch.dump(thumburls);	
 	
 	if (num_urls &gt; 0) {
 		return thumburls;
@@ -197,4 +206,64 @@ SpazImageURL.prototype.getThumbsForUrls = function(str) {
 		return null;
 	}
 	
-};
\ No newline at end of file
+};
+
+
+
+/**
+ * find the image service URLs that work with our defined APIs in a given string
+ * @param {object} matches
+ * @return {object|null} fullurl:thumburl key:val pairs
+ */
+SpazImageURL.prototype.getImagesForMatches = function(matches) {
+	var x, service, api, imageurl, imageurls = {}, num_urls = 0;
+	
+	for (service in matches) {
+		sch.dump('SERVICE:'+service);
+		api = this.getAPI(service);
+		urls = matches[service]; // an array
+		sch.dump(&quot;URLS:&quot;+urls);
+		imageurls[urls[0]] = api.getImageUrl(urls[1]);
+		num_urls++;
+	}
+
+	sch.dump('num_urls:'+num_urls);
+	sch.dump(imageurls);	
+	
+	if (num_urls &gt; 0) {
+		return imageurls;
+	} else {
+		return null;
+	}
+};
+
+
+/**
+ * given a string, this returns a set of key:val pairs of main url:image url
+ * for image hosting services for urls within the string
+ * @param {string} str
+ * @return {object|null} fullurl:imageurl key:val pairs
+ */
+SpazImageURL.prototype.getImagesForUrls = function(str) {
+	var matches = this.findServiceUrlsInString(str);
+	if (matches) {
+		return this.getImagesForMatches(matches);
+	} else {
+		return null;
+	}
+};
+
+
+/**
+ * given a single image hosting service URL, this returns a URL to the image itself
+ * @param {string} url
+ * @return {string|null}
+ */
+SpazImageURL.prototype.getImageForUrl = function(url) {
+	var urls = this.getImagesForUrls(url);
+	if (urls) {
+		return urls[url];
+	} else {
+		return null;
+	}
+};</diff>
      <filename>libs/spazimageurl.js</filename>
    </modified>
    <modified>
      <diff>@@ -26,6 +26,7 @@ var SPAZCORE_EXPANDABLE_DOMAINS = [
 	'cli.gs',
 	'ff.im',
 	'is.gd',
+	'j.mp',
 	'ow.ly',
 	'poprl.com',
 	'short.ie',</diff>
      <filename>libs/spazshorturl.js</filename>
    </modified>
    <modified>
      <diff>@@ -350,6 +350,12 @@ $(document).ready(function() {
 		var expect = &quot;&amp;lt;script src=&amp;quot;../helpers/xml.js&amp;quot; type=&amp;quot;text/javascript&amp;quot; charset=&amp;quot;utf-8&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&quot;;
 		equals(result, expect);
 	});
+	test(&quot;escape_html&quot;, function() {
+		var input  = &quot;http://www.youtube.com/watch?v=tGsq9CFgP9E&amp;feature=related&quot;;
+		var result = sc.helpers.escape_html(input);
+		var expect = &quot;http://www.youtube.com/watch?v=tGsq9CFgP9E&amp;amp;feature=related&quot;;
+		equals(result, expect);
+	});
 	test(&quot;utf8.encode&quot;, missing);
 	test(&quot;utf8.decode&quot;, missing);
 	test(&quot;trim&quot;, function() {</diff>
      <filename>tests/helper_tests.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>eb78754bbbdf0dba62c3e3d45440ae16d63de1a1</id>
    </parent>
  </parents>
  <author>
    <name>Ed Finkler</name>
    <email>funkatron@gmail.com</email>
  </author>
  <url>http://github.com/funkatron/spazcore/commit/20847c2cbb4cbedaeedc14c7b628bbf4fdc6f74c</url>
  <id>20847c2cbb4cbedaeedc14c7b628bbf4fdc6f74c</id>
  <committed-date>2009-09-23T15:09:22-07:00</committed-date>
  <authored-date>2009-09-23T15:09:22-07:00</authored-date>
  <message>- added methods in spazimageurl to retrieve full-size URLs
- added j.mp to short URL list in spazshorturl.js
- added test for escape_html helper</message>
  <tree>9ede9e9ad8a2224df06e95847f4f64214945b43c</tree>
  <committer>
    <name>Ed Finkler</name>
    <email>funkatron@gmail.com</email>
  </committer>
</commit>
