diff --git a/class-wp-codebird.php b/class-wp-codebird.php
index 39001c1837b2f69edf97f7c6733b51dce3bc181a..02aea42b69c77ce2d5191a2aef77e0582940e253 100644
--- a/class-wp-codebird.php
+++ b/class-wp-codebird.php
@@ -326,22 +326,31 @@ class WP_Codebird extends \Codebird\Codebird {
 
 			// check for filenames
 			if ( in_array( $key, $possible_files ) ) {
-				if (
-					in_array( strtolower( end( explode( ".", $value ) ) ), $this->_supported_media_files_extensions )
-					&& file_exists( $value )
+				$data = false;
+
+				if ( filter_var( $value, FILTER_VALIDATE_URL ) ) {
+					$filename = basename( parse_url( $value, PHP_URL_PATH ) );
+					if ( $this->is_supported_media_file_extension( $filename ) ) {
+						$data = getimagesize( $value );
+					}
+				} elseif (
+					file_exists( $value )
 					&& is_readable( $value )
-					&& $data = getimagesize( $value )
+					&& $this->is_supported_media_file_extension( basename( $value ) )
 				) {
-					if ( // is it a supported image format?
-					in_array( $data[2], $this->_supported_media_files )
-					) {
-						// try to read the file
-						$data = file_get_contents( $value );
-						if ( strlen( $data ) == 0 ) {
-							continue;
-						}
-						$value = $data;
+					$data = getimagesize( $value );
+				} 
+
+				// is it a supported image format?
+				if ( $data && in_array( $data[2], $this->_supported_media_files ) ) {
+					// try to read the file
+					$data = file_get_contents( $value );
+					if ( strlen( $data ) == 0 ) {
+						continue;
 					}
+					$value = $data;
+				} else {
+					continue;
 				}
 			}
 
@@ -353,4 +362,9 @@ class WP_Codebird extends \Codebird\Codebird {
 		return $multipart_request;
 	}
 
+	private function is_supported_media_file_extension( $filename ) {
+		$extension = pathinfo( $filename, PATHINFO_EXTENSION );
+		return in_array( strtolower( $extension ), $this->_supported_media_files_extensions );
+	}
+
 }