             let paddingEdges: CGFloat = 5
             backgroundFrame = NSMakeRect(frame.origin.x + paddingEdges, 20, frame.size.width, frame.size.height - ChatMessageView.TimeHeight + 2)
             backgroundFrame.size.width *= ChatMessageView.WidthPercentage
+            NSLog("%f",frame.size.width)
 
             let textMaxWidth = ChatMessageView.widthOfText(backgroundWidth: backgroundFrame.size.width)
             let textSize = ChatMessageView.textSizeInWidth(self.textLabel.attributedStringValue, width: textMaxWidth)
             let dateSize = ChatMessageView.textSizeInWidth(self.timeLabel.attributedStringValue, width: textMaxWidth)
 
             backgroundFrame.size.width = ChatMessageView.widthOfBackground(textWidth: textSize.width)
-            backgroundFrame.size.height = textSize.height + ChatMessageView.VerticalTextPadding / 2 + 5
+            if mmsView.frame.width > 0 {
+                backgroundFrame.size.width += mmsView.frame.width + 20
+            }
+            backgroundFrame.size.height =  textSize.height + ChatMessageView.VerticalTextPadding / 2 + 5
+            if mmsView.frame.height > 0 {
+                backgroundFrame.size.height += mmsView.frame.height + 20
+            }
             
             switch (orientation) {
             case .Left:


    //var backgroundView: NSImageView!
    var backgroundView: NSView!
    var mmsView: NSView = NSView(frame: NSMakeRect(0,0,150,150))

    var orientation: Orientation = .Left
    static let font = NSFont.systemFontOfSize(NSFont.systemFontSize())


    override init(frame frameRect: NSRect) {
        super.init(frame: frameRect)
        
        backgroundView = NSView(frame: NSZeroRect)
        backgroundView.wantsLayer = true
        backgroundView.layer!.cornerRadius = 5
        backgroundView.layer!.backgroundColor = NSColor.NSColorFromHex(messagesGray).CGColor
        addSubview(backgroundView)
        
        mmsView = NSView(frame: NSZeroRect)
        mmsView.wantsLayer = true
        addSubview(mmsView)
        
        timeLabel = NSTextField(frame: NSZeroRect)
        timeLabel.backgroundColor = NSColor.clearColor()
