static function fetchImageAttributesByFilepath( $filepath, $contentObjectAttributeID )
    {
        $db = eZDB::instance();
        $contentObjectAttributeID = (int) $contentObjectAttributeID;

        $cond = array( 'id' => $contentObjectAttributeID );
        $fields = array( 'contentobject_id', 'contentclassattribute_id' );
        $limit = array( 'offset' => 0, 'length' => 1 );
        $rows = eZPersistentObject::fetchObjectList( eZContentObjectAttribute::definition(),
                                                     $fields,
                                                     $cond,
                                                     null,
                                                     $limit,
                                                     false );
        if ( count( $rows ) != 1 )
            return array();

        $contentObjectID = (int)( $rows[0]['contentobject_id'] );
        $contentClassAttributeID = (int)( $rows[0]['contentclassattribute_id'] );
        // Transform ", &, < and > to entities since they are being transformed in entities by DOM
        // See eZImageAliasHandler::initialize()
        // Ref https://jira.ez.no/browse/EZP-20090
        $filepath = $db->escapeString(
            htmlspecialchars(
                $filepath,
                // Forcing default flags to be able to specify encoding. See http://php.net/htmlspecialchars
                version_compare( PHP_VERSION, '5.4.0', '>=' ) ? ENT_COMPAT | ENT_HTML401 : ENT_COMPAT,
                'UTF-8'
            )
        );
        // Escape _ in like to avoid it to act as a wildcard !
        $filepath = addcslashes( $filepath, "_" );
        $query = "SELECT id, version, language_code
                  FROM   ezcontentobject_attribute
                  WHERE  contentobject_id = $contentObjectID AND
                         contentclassattribute_id = $contentClassAttributeID AND
                         data_text LIKE '%url=\"$filepath\"%'";
        if ( $db->databaseName() == 'oracle' )
        {
            $query .= " ESCAPE '\'";
        }
        $rows = $db->arrayQuery( $query );
        return $rows;
    }