Index: kernel/classes/datatypes/ezimage/ezimagealiashandler.php
===================================================================
--- kernel/classes/datatypes/ezimage/ezimagealiashandler.php	(revision 24729)
+++ kernel/classes/datatypes/ezimage/ezimagealiashandler.php	(working copy)
@@ -721,6 +721,12 @@
         $contentObjectAttributeVersion = $this->ContentObjectAttributeData['version'];
         $contentObjectAttributeID = $this->ContentObjectAttributeData['id'];
 
+        if ( !is_object( $contentObjectAttribute )  )
+        {
+            $contentObjectAttribute = eZContentObjectAttribute::fetch( $this->ContentObjectAttributeData['id'],
+                                                                       $this->ContentObjectAttributeData['version'] );
+        }
+
         $isImageOwner = $this->isImageOwner();
 
         // We loop over each image alias, and look up the file in ezcontentobject_attribute
@@ -738,7 +744,7 @@
 
                 // Fetch ezimage attributes that use $filepath
                 // Always returns current attribute (array of $contentObjectAttributeID and $contentObjectAttributeVersion)
-                $dbResult = eZImageFile::fetchImageAttributesByFilepath( $filepath, $contentObjectAttributeID );
+                $dbResult = eZImageFile::fetchImageAttributesByFilepath( $filepath, $contentObjectAttribute->attribute( 'contentclassattribute_id' ) );
                 $dbResultCount = count( $dbResult );
                 // Check if there are the attributes.
                 if ( $dbResultCount > 0 )
Index: kernel/classes/datatypes/ezimage/ezimagefile.php
===================================================================
--- kernel/classes/datatypes/ezimage/ezimagefile.php	(revision 24729)
+++ kernel/classes/datatypes/ezimage/ezimagefile.php	(working copy)
@@ -95,24 +95,24 @@
 
     /**
      * Looks up ezcontentobjectattribute entries matching an image filepath and
-     * a contentobjectattribute ID
+     * a content class attribute ID
      *
      * @param string $filePath file path to look up as URL in the XML string
-     * @param int $contentObjectAttributeID
+     * @param int $contentClassAttributeID
      *
-     * @return array An array of ids and versions of image files where the url
-     *               is referenced
+     * @return array An array of content object attribute ids and versions of
+     *               image files where the url is referenced
      *
      * @todo Rewrite ! A where data_text LIKE '%xxx%' is a resource hog !
      **/
-    static function fetchImageAttributesByFilepath( $filepath, $contentObjectAttributeID )
+    static function fetchImageAttributesByFilepath( $filepath, $contentClassAttributeID )
     {
        $db = eZDB::instance();
        $filepath = $db->escapeString( $filepath );
-       $contentObjectAttributeID =(int) $contentObjectAttributeID;
+       $contentClassAttributeID = (int) $contentClassAttributeID;
        $query = "SELECT id, version
                  FROM   ezcontentobject_attribute
-                 WHERE  id = $contentObjectAttributeID and
+                 WHERE  contentclassattribute_id = $contentClassAttributeID and
                         data_text like '%url=\"$filepath\"%'";
 
        $rows = $db->arrayQuery( $query );
