if let img = img {
            if !square {
                frame.size.height = CGFloat(size)
                frame.size.width = CGFloat(size) * img.size.width / img.size.height
            } else {