diff --git a/field/flickrfield.module b/field/flickrfield.module
index af86cce..27e12ce 100644
--- a/field/flickrfield.module
+++ b/field/flickrfield.module
@@ -473,7 +473,7 @@ function theme_flickrfield_photo($variables) {
   // If it is not a square.
   if (!isset($width)) {
     // Get the real width of the image.
-    list($width) = getimagesize($img_url);
+    $width = ranger($img_url);
   }
   $title = is_array($photo_data['title']) ? $photo_data['title']['_content'] : $photo_data['title'];
   // Image width < 100 px is too small for most titles. Can be set differently.
@@ -546,7 +546,7 @@ function theme_flickrfield_photoset($variables) {
       // If it is not a square.
       if ($formatter != 's' && $formatter != 'q') {
         // Get the real width of the image.
-        list($width) = getimagesize($img_url);
+        $width = ranger($img_url);
       }
       // Insert owner into $photo because theme_flickr_photo needs it.
       $photo['owner'] = $photos['photoset']['owner'];
diff --git a/flickr.module b/flickr.module
index fedb587..5bd51b4 100644
--- a/flickr.module
+++ b/flickr.module
@@ -319,7 +319,7 @@ function theme_flickr_photo($variables) {
   // If it is not a square.
   if (!isset($width)) {
     // Get the real width of the image.
-    list($width) = getimagesize($img_url);
+    $width = ranger($img_url);
   }
   $photo_url = flickr_photo_page_url($photo['owner'], $photo['id']);
   $title = is_array($photo['title']) ? $photo['title']['_content'] : $photo['title'];
@@ -523,3 +523,19 @@ function theme_flickr_photoset($variables) {
       ));
   }
 }
+
+/**
+ * Alternative to the slower PHP function getimagesize. See
+ * http://stackoverflow.com/questions/4635936/super-fast-getimagesize-in-php.
+ */
+function ranger($url) {
+  $headers = array("Range: bytes=0-32768");
+  $curl = curl_init($url);
+  curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
+  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+  $data = curl_exec($curl);
+  curl_close($curl);
+  $im = imagecreatefromstring($data);
+  $width = imagesx($im);
+  return $width;
+}
