diff --git a/dummyimage.module b/dummyimage.module
index 6b52b90..b8f4cf2 100644
--- a/dummyimage.module
+++ b/dummyimage.module
@@ -101,12 +101,16 @@ function dummyimage_admin_form($form, &$form_state) {
  * Replaces images with dummy images.
  */
 function dummyimage_preprocess_image(&$variables) {
+  global $base_url, $base_path;
   if (!isset($variables['style_name'])) {
     return;
   }
   switch (variable_get('dummyimages_generate', DUMMYIMAGE_GENERATE_NONE)) {
     case DUMMYIMAGE_GENERATE_MISSING:
-      if (is_file($variables['path'])) {
+      // The path variable is already the full url to the image, so we 
+      // need to strip this off first to test.
+      $real_file = str_replace($base_url . $base_path, '', $variables['path']);
+      if (is_file($real_file)) {
         break;
       }
     case DUMMYIMAGE_GENERATE_ALL:
