Skip to content

Commit

Permalink
fix: strip retina based prefix to use original url
Browse files Browse the repository at this point in the history
  • Loading branch information
selul committed Nov 4, 2019
1 parent 5f9abfe commit 948c667
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion inc/app_replacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ public function can_replace_url( $url ) {
**/
public function strip_image_size_from_url( $url ) {

if ( preg_match( '#(-\d+x\d+(?:_c)?)\.(' . implode( '|', array_keys( Optml_Config::$extensions ) ) . '){1}$#i', $url, $src_parts ) ) {
if ( preg_match( '#(-\d+x\d+(?:_c)?|(@2x))\.(' . implode( '|', array_keys( Optml_Config::$extensions ) ) . '){1}$#i', $url, $src_parts ) ) {
$stripped_url = str_replace( $src_parts[1], '', $url );
// Extracts the file path to the image minus the base url
$file_path = substr( $stripped_url, strpos( $stripped_url, $this->upload_resource['url'] ) + $this->upload_resource['url_length'] );
Expand Down

0 comments on commit 948c667

Please sign in to comment.