# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: C:\Users\Tim\Documents\Project K\site_dev\sites\all\modules\_modified\mimemail
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: mimemail.inc
--- mimemail.inc Base (BASE)
+++ mimemail.inc Locally Modified (Based On LOCAL)
@@ -136,6 +136,12 @@
       }
       // The $url is a relative file path, continue processing.
       else {
+
+        //Make sure imagecache images are generated before trying to attach
+      if (module_exists("imagecache")) {
+        mimemail_generate_imagecache($url);
+      }
+
         // Download method is private, and the $url needs conversion.
         if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE && strpos($url, 'system/files/') !== FALSE) {
           $file = file_create_path(drupal_substr($url, (strpos($url, 'system/files/') + drupal_strlen('system/files/'))));
@@ -643,3 +649,24 @@
 
   return FALSE;
 }
+
+/**
+ * Checks to ensure that imagecache file is created before attaching
+ * @param string $url Path to file
+ */
+function mimemail_generate_imagecache($url) {
+  static $paths;
+  if (isset($paths[$url])) { //if we've already checked this path, then don't waste time rechecking
+    return;
+  }
+
+  $offset = strpos($url, "/imagecache/");
+  if ($offset !== FALSE) {
+    $args = explode("/", substr($url, $offset + 12)); //Get path after /imagecache/ (12 chars long)
+    $preset = check_plain(array_shift($args));
+    $path = substr($url, 0, $offset) . "/" . implode('/', $args);
+    imagecache_generate_image($preset, $path);
+  }
+  $paths[$url] = TRUE;
+    return;
+}
