Is it possible to get local image URL when also having photon active?

Definitely a hack solution, but the only one I know got to work thus far…

<?php $bkg_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single_post_thumbnail' ); ?>

<style>
  span {
    background-image: url('<?php echo preg_replace("/\.jpg.*/", "-50x50.jpg", $bkg_image[0]); ?>');
  }
</style>

Basically, I am fetching the non-photon URL, and doing a string replace of the end image URL ‘.jpg’ to ‘-50×50.jpg’ (which is the size of the blog-widget image size)

If there is a better solution, that is not as hacky PLEASE share!

The only issue that I can think of is when the extension is not .jpg, but .png or gif. If there is a way I can add ‘-50×50’ before the last ‘.’, that would help I assume.

Thanks,
Roc.


Of course, posting and then finding alternate solution:

To add characters before end of extension:
https://stackoverflow.com/questions/2429611/regex-how-to-insert-string-before-file-extension

<?php 
  $bkg_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single_post_thumbnail' );  
  $extension_pos = strrpos($bkg_image[0], '.'); // find position of the last dot, so where the extension starts
  $thumb = substr($bkg_image[0], 0, $extension_pos) . '-50x50' . substr($bkg_image[0], $extension_pos);
?>

<style>
  span {
    background-image: url('<?php echo $thumb; ?>');
  }
</style>

This is a alternate fix for the first answer I posted above, of how to add a string before an extension… not one for the photon solution.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)