@@ -228,6 +228,7 @@ function ( $item ) use ( $transformation_index ) {
228228 * @param string|null $public_id The Public ID to get a url for.
229229 * @param array $args Additional args.
230230 * @param array $size The WP Size array.
231+ * @param bool $clean Flag to produce a non variable size url.
231232 *
232233 * @return string
233234 */
@@ -398,10 +399,11 @@ public function upload_large( $attachment_id, $args ) {
398399 * @param int $attachment_id Attachment ID to upload.
399400 * @param array $args Array of upload options.
400401 * @param array $headers Additional headers to use in upload.
402+ * @param bool $try_remote Flag to try_remote upload.
401403 *
402404 * @return array|\WP_Error
403405 */
404- public function upload ( $ attachment_id , $ args , $ headers = array () ) {
406+ public function upload ( $ attachment_id , $ args , $ headers = array (), $ try_remote = true ) {
405407
406408 $ resource = ! empty ( $ args ['resource_type ' ] ) ? $ args ['resource_type ' ] : 'image ' ;
407409 $ resource = $ this ->convert_resource_type ( $ resource );
@@ -415,7 +417,7 @@ public function upload( $attachment_id, $args, $headers = array() ) {
415417 $ disable_https_fetch = false ;
416418 }
417419 // Check if we can try http file upload.
418- if ( empty ( $ headers ) && empty ( $ disable_https_fetch ) ) {
420+ if ( empty ( $ headers ) && empty ( $ disable_https_fetch ) && true === $ try_remote ) {
419421 $ args ['file ' ] = $ file_url ;
420422 } else {
421423 // We should have the file in args at this point, but if the transient was set, it will be defaulting here.
0 commit comments