vnbaaij / ImageProcessor.Web.Episerver

Integrate ImageProcessor into Episerver and use it in your views with a fluent API. For Editor integration do not use ImageProcessor.Web.Episerver.UI but instead use ImageProcessor.Web.Episerver.UI.Blocks. For more information see
http://world.episerver.com/blogs/vincent-baaij/dates/2017/10/episerver-and-imageprocessor-more-choice-for-developers-and-designers/
MIT License
20 stars 9 forks source link

Azure DXC not cropping images #8

Closed wiske80 closed 6 years ago

wiske80 commented 6 years ago

Hi i'm not sure what i am missing. I have a site running on epi' DXC azure. And CMS 11

Locally using FileBlobCache and normal ImageService everything works, but when deploying to DXC the cropping doesnt work.

I think it might be my config files. my cache.config is this

<caching currentCache="EpiserverBlobCache">
  <caches>    
    <cache name="AzureBlobCacheEpi" type="ImageProcessor.Web.Episerver.Azure.AzureBlobCache, ImageProcessor.Web.Episerver.Azure" maxDays="5">
      <settings>      
      </settings>
    </cache>  
  </caches>
</caching>

while my security.config looks like this

<security >
  <services>     
      <service name="AzureImageService" type="ImageProcessor.Web.Episerver.Azure.ImageService, ImageProcessor.Web.Episerver.Azure">
        <settings>
          <setting key="MaxBytes" value="8194304"/>
          <setting key="Timeout" value="30000"/>
        </settings>
      </service>
  </services>
</security>

nuget package 2.1.0 of the Imageprocessor.Web.Episerver.Azure package and the 2.1.1 of the Normal Imagaprocesor.Web.Episerver are installed.

I must be missing something in my configuration somewhere?

Kind regards

vnbaaij commented 6 years ago

Hi,

Config looks good to me. What seems to be a problem is that the access rights for the blob storage container are not ok. Can you check if that container has ‘Public read access for container and blobs’. If not, adjust the rights and retry.

Please let me know if this solves it.

Thanks, Vincent Baaij

wiske80 commented 6 years ago

I think the rights are correct, because images can be stored in blob container and they are being read on the site...

Only the cropping doesn't seem to work.. See my link

I need to ask this specific to epi because it's managed by them..

On Thu, Jul 19, 2018, 16:41 Vincent Baaij notifications@github.com wrote:

Hi,

Config looks good to me. What seems to be a problem is that the access rights for the blob storage container are not ok. Can you check if that container has ‘Public read access for container and blobs’. If not, adjust the rights and retry.

Please let me know if this solves it.

Thanks, Vincent Baaij From: wiske80 notifications@github.com Sent: donderdag 19 juli 2018 16:35 To: vnbaaij/ImageProcessor.Web.Episerver < ImageProcessor.Web.Episerver@noreply.github.com> Cc: Subscribed subscribed@noreply.github.com Subject: [vnbaaij/ImageProcessor.Web.Episerver] Azure DXC not cropping images (#8)

Hi i'm not sure what i am missing. I have a site running on epi' DXC azure.

Locally using diskcaching everything works, but when deploying to DXC the cropping doesnt work.

I think it might be my config files. my cache.config is this

while my security.config looks like this

nuget package 2.1.0 of the Imageprocessor.Web.Episerver.Azure package and the 2.1.1 of the Normal Imagaprocesor.Web.Episerver are installed.

A quick example of the image not working.

https://hyva02mstr70wa3inte.dxcloud.episerver.net/globalassets/product-images/01.-tipping/man-tipper-in-mining-environment.jpg?quality=80&width=1024&mode=crop&heightratio=0.5625

I must be missing something in my configuration somewhere?

Kind regards

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub< https://github.com/vnbaaij/ImageProcessor.Web.Episerver/issues/8>, or mute the thread< https://github.com/notifications/unsubscribe-auth/ABrfN6TXI9QV5EQef4PArfmehpv5u0PZks5uIJkggaJpZM4VWhB1>.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vnbaaij/ImageProcessor.Web.Episerver/issues/8#issuecomment-406300630, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVV-yc3ogVP8f7txlzvw0OMT9hhVsAEks5uIJqngaJpZM4VWhB1 .

vnbaaij commented 6 years ago

I know. Strange this is that is does get written in this case when Episerver does it (through blob provider) but it does go wrong when my module tries it. I've seen it happen before...

If it is on integration or pre production, you should be able to change it yourself. You need the blob connection string and a tool like the Microsoft Azure Storage Explorer.

Hope this helps.

ErikHen commented 6 years ago

It seems that ImageProcessor is not processing your image at all, it's not just cropping that doesn't work. Here's how my cache.config looks like on DXC: `<?xml version="1.0" encoding="utf-8"?>

` I have all the different cacheproviders in cache.config and then switch "currentCache" using config transformation for the different environments. It seems that your current cache is set to "EpiserverAzureBlobCache", but your cache provider name is "AzureBlobCacheEpi" , and that migth be your problem.
vnbaaij commented 6 years ago

@ErikHen Erik Good catch! @wiske80 Erik is right. In your cache.config change <caching currentCache="EpiserverBlobCache"> to <caching currentCache="AzureBlobCacheEpi">

wiske80 commented 6 years ago

I made some typo's in my first post.

I just checked on the Integration environment and this is my actual cache.config

<?xml version="1.0" encoding="utf-8"?>
<caching currentCache="EpiserverAzureBlobCache">
  <caches>
    <cache name="DiskCache" type="ImageProcessor.Web.Caching.DiskCache, ImageProcessor.Web" maxDays="30" browserMaxDays="7">
      <settings>
        <setting key="VirtualCachePath" value="~/app_data/cache"/>
      </settings>
    </cache>
    <cache name="EpiserverBlobCache" type="ImageProcessor.Web.Episerver.FileBlobCache, ImageProcessor.Web.Episerver" maxDays="30" browserMaxDays="7">
      <settings>
        <setting key="VirtualCachePath" value="\\vt-umbraco-001.dev.tamtam.nl\Inetpub\Hyva\blob\cache"/>
      </settings>      
    </cache>
    <cache name="EpiserverAzureBlobCache" type="ImageProcessor.Web.Episerver.Azure.AzureBlobCache, ImageProcessor.Web.Episerver.Azure" maxDays="30">
      <settings>
        <setting key="UseCachedContainerInUrl" value="true"/>
        <setting key="StreamCachedImage" value="false"/>
      </settings>
    </cache>
  </caches>
</caching>

And this is my actual security.config on my Integration

<?xml version="1.0" encoding="utf-8"?>
<security>
  <services>    
    <!--Disable the LocalFileImageService and enable this one when using virtual paths. -->
    <!--<service name="CloudImageService" type="ImageProcessor.Web.Services.CloudImageService, ImageProcessor.Web">
      <settings>
        <setting key="Container" value=""/>
        <setting key="MaxBytes" value="8194304"/>
        <setting key="Timeout" value="30000"/>
        <setting key="Host" value="http://yourhost.com/"/>
      </settings>
    </service>-->
    <service prefix="remote.axd" name="RemoteImageService" type="ImageProcessor.Web.Services.RemoteImageService, ImageProcessor.Web">
      <settings>
        <setting key="MaxBytes" value="4194304"/>
        <setting key="Timeout" value="3000"/>
        <setting key="Protocol" value="http"/>
      </settings>
      <whitelist>
      </whitelist>
    </service>
    <service name="AzureImageService" type="ImageProcessor.Web.Episerver.Azure.ImageService, ImageProcessor.Web.Episerver.Azure">
      <settings>
        <setting key="MaxBytes" value="8194304"/>
        <setting key="Timeout" value="30000"/>
      </settings>
    </service>
  </services>
</security>

But i will try the access settings with azure explorer... i have access to integration

wiske80 commented 6 years ago

i got it working.. the problem was indeed the "Public read access for container and blobs" on the container in azure. So i need to ask Epi to change those for the preproduction and production containers aswell..

can someone tell me what these settings do exactly:

<settings>
        <setting key="UseCachedContainerInUrl" value="true"/>
        <setting key="StreamCachedImage" value="false"/>
      </settings>

If i remove the settings completely, images are all broken.. so i was wondering what they are exactly.

Thanks for the help @vnbaaij

vnbaaij commented 6 years ago

@wiske80 Both settings come from the original CloudBlobProviceder (and are removed in version 3 which is pending approval on the feed) StreamCachedImage is what controls the rewrite. UseCachedContainerInUrl is needed so 'hyvamedia' (in your situation) is included in the url

wiske80 commented 6 years ago

ok good to know.. so for now i can keep it like this right? These are the best settings for azure blob storage..?

vnbaaij commented 6 years ago

yes, keep it like this

wiske80 commented 6 years ago

Vincent,

I have been in a big discussion with Episerver, because they refuse to give the preproduction and production DXC blob containers 'public read access' due to security reasons.

So i'm back to square 1. They said that i need to ask you to look into making the package work with containers that don't have those rights. Now i'm don't know the ins and outs of why we need 'public read access' but can you give some insight if we can make this work also with the default status of the DXC blob containers Epi provides.

vnbaaij commented 6 years ago

Vishal,

I just posted the 3.0.1 version of the Azure package to the feed. That version should work with the standard DXC blob containers. Can you please test and verify it works as expected. If not, I'll need more time to investigate. In between two holidays now and won't be abel to work on it till end of august.

wiske80 commented 6 years ago

Hi Vincent,

Yes i saw that, and i'm on that release. And that release works on Integration with "public read access" but not when public read access is not set.

It creates the cache file on the blob(episerver confirmed that for me on the preprod blob container), and you can see it redirect to the cached file but it cannot show the image (resource not found error).

I say first enjoy your holiday.. that's important also.. We have a golive planned for 10th of september, so we still have some time left. So end of august should be fine. For now i disabled imageprocessor as all the images were broken on preproduction.

vnbaaij commented 6 years ago

Vishal,

This is a new version for the Azure package. I just pushed it to the feed, so you can not be on that one yet :) The core package was on 3.0.1 already indeed.

wiske80 commented 6 years ago

ahh my bad... i think i will need to wait for it to be visible on the feed then..sometimes it takes a couple of hours... i will keep you posted..

vnbaaij commented 6 years ago

If you want to install manually, I just published a release here off the latest versions

wiske80 commented 6 years ago

Nice Vincent.. The update fixed the problem on preproduction. Thanks for that.

Is there also a extension method to use in a webapi/mvc controller to get a cropped image given an image contentreference.

Now we have only htmlhelper extensions (ProcessImage), but i was wondering if there is also one to just use on a image contentreference for example?

vnbaaij commented 6 years ago

Nope, there is no such extension (yet). Think it would be fairly easy to add one. Will take a look at it after the holidays