1

We run all our images through a CDN to perform various manipulations. This works create for any image managed via assets, but I'm a bit stuck on any image that has a cpresources URL. In particular I'm running into this issue with profile photos which have a URL much like this:

http://www.mydomain.com/cpresources/userphotos/janedoe/100/JaneDoe.jpg

In the above, I just need to change the URL to something like http://cdn.mydomain.com/cpresources/userphotos/janedoe/100/JaneDoe.jpg

This image will then get downloaded from the www.mydomain.com host.

I did run into this issue with assets too tonight, where there was an issue with an image that didn't get moved into it's final destination, and ended up living in the temp folder, with a cpresources URL.

Is there any way to change this URL?

  • Is there a reason you want to serve CP images from a CDN? – Brad Bell Apr 7 '16 at 18:32
  • Yes, for starters we are use to to do face detection, so users with no editing skills can upload any old photo, we then have it crop it intelligently to suit our design, the requirements for that crop can be different depending on the page we are displaying it on, CDN (imgix in this case) handles this perfectly. To be clear though, this is only uploaded image, control panel images specific to craft we don't care about. There are a number of other things we use it for but this is the key one in this instance. imagemacick is dead to me – neekster Apr 8 '16 at 3:40
  • Oh, so it's more than just a CDN and it's not for all cpresources just uploaded assets. I think you'd have to do this through a custom plugin that integrates with Imgix. – Brad Bell Apr 8 '16 at 17:55
1

Never too late to answer your own question.

This is easily resolved now as Craft 3 stores user photos as assets, you just need to assign the CDN URL to the public URL field in Assets.

https://docs.craftcms.com/v3/changes-in-craft-3.html#user-photos

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.