File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -540,20 +540,13 @@ public function get_local_attachement_id_from_url( $url ) {
540
540
541
541
$ size = 'full ' ;
542
542
$ found_size = $ this ->parse_dimensions_from_filename ( $ url );
543
- $ strip_url = $ url ;
544
- $ scaled_url = $ url ;
543
+ $ url = $ this ->add_schema ( $ url );
545
544
if ( $ found_size [0 ] !== false && $ found_size [1 ] !== false ) {
546
- $ size = $ found_size ;
547
- $ strip_url = str_replace ( '- ' . $ found_size [0 ] . 'x ' . $ found_size [1 ], '' , $ url );
548
- $ scaled_url = str_replace ( '- ' . $ found_size [0 ] . 'x ' . $ found_size [1 ], '-scaled ' , $ url );
549
- }
550
- $ strip_url = $ this ->add_schema ( $ strip_url );
545
+ $ size = $ found_size ;
551
546
552
- $ attachment_id = attachment_url_to_postid ( $ strip_url );
553
- if ( $ attachment_id === 0 ) {
554
- $ scaled_url = $ this ->add_schema ( $ scaled_url );
555
- $ attachment_id = attachment_url_to_postid ( $ scaled_url );
556
547
}
548
+ $ url = $ this ->add_schema ( $ url );
549
+ $ attachment_id = $ this ->attachment_url_to_post_id ( $ url );
557
550
558
551
return [ 'attachment_id ' => $ attachment_id , 'size ' => $ size ];
559
552
}
You can’t perform that action at this time.
0 commit comments