+function fromgplus_parse_query($var)
+ {
+ /**
+ * Use this function to parse out the query array element from
+ * the output of parse_url().
+ */
+ $var = parse_url($var, PHP_URL_QUERY);
+ $var = html_entity_decode($var);
+ $var = explode('&', $var);
+ $arr = array();
+
+ foreach($var as $val) {
+ $x = explode('=', $val);
+ $arr[$x[0]] = $x[1];
+ }
+ unset($val, $x, $var);
+ return $arr;
+}
+
+function fromgplus_cleanupgoogleproxy($fullImage, $image) {
+
+ $preview = "/w".$fullImage->width."-h".$fullImage->height."/";
+ $preview2 = "/w".$fullImage->width."-h".$fullImage->height."-p/";
+ $fullImage = str_replace(array($preview, $preview2), array("/", "/"), $fullImage->url);
+
+ $preview = "/w".$image->width."-h".$image->height."/";
+ $preview2 = "/w".$image->width."-h".$image->height."-p/";
+ $image = str_replace(array($preview, $preview2), array("/", "/"), $image->url);
+
+ $cleaned = array();
+
+ $queryvar = fromgplus_parse_query($fullImage);
+ if ($queryvar['url'] != "")
+ $cleaned["full"] = urldecode($queryvar['url']);
+ else
+ $cleaned["full"] = $fullImage;
+ if (@exif_imagetype($cleaned["full"]) == 0)
+ $cleaned["full"] = "";
+
+ $queryvar = fromgplus_parse_query($image);
+ if ($queryvar['url'] != "")
+ $cleaned["preview"] = urldecode($queryvar['url']);
+ else
+ $cleaned["preview"] = $image;
+ if (@exif_imagetype($cleaned["preview"]) == 0)
+ $cleaned["preview"] = "";
+
+ if ($cleaned["full"] == "") {
+ $cleaned["full"] = $cleaned["preview"];
+ $cleaned["preview"] = "";
+ }
+
+ if ($cleaned["full"] == $cleaned["preview"])
+ $cleaned["preview"] = "";
+
+ if ($cleaned["full"] == "")
+ if (@exif_imagetype($fullImage) != 0)
+ $cleaned["full"] = $fullImage;