syamilmj / Aqua-Resizer

Resize WordPress images on the fly
502 stars 208 forks source link

Jetpack Photon doesn't seem to work when aqua resizer is being used. #13

Closed wpexplorer closed 11 years ago

wpexplorer commented 11 years ago

Hey friend,

It doesn't seem like JetPack Photon works when using aqua resizer (in my case) I'd really like to get these two working together. Have you any experience with this or heard about this from someone else?

syamilmj commented 11 years ago

I've never used Photon before, so I'm not sure how it works.

Does it search & replace the image URL's in the_content only?

Cheers

wpexplorer commented 11 years ago

It's supposed to work on featured images as well I havent really looked into it, just wondering if u had, not a biggy ;)

syamilmj commented 11 years ago

I'll have a look into Photon codes and see if I can hack it to support this script :)

Cheers

wpexplorer commented 11 years ago

Oh cool. If you can make it work I'll send you some monies ;)

wpexplorer commented 11 years ago

I keep trying to find you on skype, I think you wanted to chat. I'm guessing our schedules have shifted.

wpexplorer commented 11 years ago

Any luck busy man? ;)

syamilmj commented 11 years ago

Not much luck sorry. Seems like photon retrieves guid for some reasons, but I'll have to study more to see if we can just bypass that.

I'll dig deeper this weekend! ;)

wpexplorer commented 11 years ago

Fix it now!

lol. Just kidding dude. But seriously if you can get them both working happily I will sponsor the update ;)

syamilmj commented 11 years ago

Okay so here's a little strategy, and if you want photon to work, im gonna need your help to test it out:

line 106, change to

$image = apply_filter('aq_resizer_img_url', $img_url, compact($dst_w, $dst_h));

and line 110 change to:

0 => apply_filter('aq_resizer_img_url', $img_url, compact($dst_w, $dst_h)),

Then create a function:

add_filter('aq_resizer_img_url', 'aq_resizer_photon_support', 10, 2);
function aq_resizer_photon_support($img_url, $data) {
    if(function_exists('jetpack_photon_url')) {

        $args = array( 'fit' => $data['dst_w'] . ',' . $data['dst_h'] );
        return jetpack_photon_url( $img_url, $args );

    } else {
        return $img_url;
    }
}

not tested

syamilmj commented 11 years ago

Did u get to try this?

wpexplorer commented 11 years ago

For some reason I never received an email update until now. Damit. I'll have a look right now. You can always hit me up on skype too ;)

benzon commented 11 years ago

I will try it out one of the next couple of days to, unless wpexplorer found out if it worked or not yet.

Personaly i think it wood be darn greate, since its free CDN, and free stuff, is always nice.

syamilmj commented 11 years ago

Thanks mate. Do let me know if you can get them to work :)

I still have to figure out how to make sure that jetpack & photon were both activated.

syamilmj commented 11 years ago

As there seems not enough people testing & giving timely feedbacks on this I'll close this thread for now.

Cheers