Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Torbjörn 1 post 71 karma points
    Oct 05, 2018 @ 09:33
    Torbjörn
    0

    Broken imagelinks on upload

    Hi. I have never used Umbraco before but was recently tasked to migrate a Umbraco-setup to a new server. Never coded in Visual Studio or dotNet, but experience with NodeJS, PHP and Java.

    Anyhow, I got the code running on a Windows Server 2016 VM, with the media hosted on a Azure Storage blob.

    The problem is, and this was a problem even before the migration, that uploaded images gets saved in the DB without full-path to Azure. They gets saved with relative paths and then the previews doesn't work.

    I read some threads about similar problems but they didn't get me anywhere.

    Images are uploaded correctly and if ya add the https://blobcontainer.blob.core.windows.net everything works.

    My configs that I think is relevant is:

    security.config

    <?xml version="1.0" encoding="utf-8"?>
    <security>
      <services>
        <service name="LocalFileImageService" type="ImageProcessor.Web.Services.LocalFileImageService, ImageProcessor.Web" />
        <!--Disable the LocalFileImageService and enable this one when using virtual paths. -->
        <service prefix="media/" name="CloudImageService" type="ImageProcessor.Web.Services.CloudImageService, ImageProcessor.Web">
          <settings>
            <setting key="Container" value="media" />
            <setting key="MaxBytes" value="38194304" />
            <setting key="Timeout" value="30000" />
            <setting key="Host" value="http://blobcontainer.blob.core.windows.net/media" />
          </settings>
          <whitelist>
            <add url="http://blobcontainer.blob.core.windows.net" />
            <add url="https://blobcontainer.blob.core.windows.net" />
          </whitelist>
        </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>
      </services>
    </security>
    

    FileSystemProviders.config

    <?xml version="1.0"?>
    <FileSystemProviders>
    
      <!-- Media -->
      <Provider alias="media" type="Our.Umbraco.FileSystemProviders.Azure.AzureBlobFileSystem, Our.Umbraco.FileSystemProviders.Azure">
        <Parameters>
            <add key="containerName" value="media"/>
            <add key="rootUrl" value="http://blobcontainer.blob.core.windows.net/"/>
          <add key="connectionString" value="DefaultEndpointsProtocol=https;AccountName=blobcontainer;AccountKey=asfasfasf/asfafsfsa/asfafsfs==;EndpointSuffix=core.windows.net"/>
            <!--
            Optional configuration value determining the maximum number of days to cache items in the browser.
            Defaults to 365 days.
          -->
            <add key="maxDays" value="365"/>
            <!--
            When true this allows the VirtualPathProvider to use the deafult "media" route prefix regardless 
            of the container name.
          -->
            <add key="useDefaultRoute" value="true"/>
            <!--
            When true blob containers will be private instead of public what means that you can't access the original blob file directly from its blob url.
          -->
            <add key="usePrivateContainer" value="false"/>
        </Parameters>
      </Provider>
    
    </FileSystemProviders>
    

    cache.config

    <?xml version="1.0" encoding="utf-8"?>
    <caching currentCache="AzureBlobCache">
      <caches>
        <cache name="DiskCache" type="ImageProcessor.Web.Caching.DiskCache, ImageProcessor.Web" maxDays="365" browserMaxDays="7">
          <settings>
            <setting key="VirtualCachePath" value="~/app_data/cache" />
          </settings>
        </cache>
        <cache name="AzureBlobCache" type="ImageProcessor.Web.Plugins.AzureBlobCache.AzureBlobCache, ImageProcessor.Web.Plugins.AzureBlobCache" maxDays="365">
          <settings>
            <setting key="CachedStorageAccount" value="DefaultEndpointsProtocol=https;AccountName=blobcontainer;AccountKey=asfasfasf/asfafsfsa/asfafsfs==;EndpointSuffix=core.windows.net" />
            <setting key="CachedCDNRoot" value="http://blobcontainer.blob.core.windows.net" />
            <setting key="CachedBlobContainer" value="cache" />
            <setting key="SourceStorageAccount" value="DefaultEndpointsProtocol=https;AccountName=blobcontainer;AccountKey=asfasfasf/asfafsfsa/asfafsfs==;EndpointSuffix=core.windows.net" />
            <setting key="SourceBlobContainer" value="media" />
            <setting key="StreamCachedImage" value="false" />
          </settings>
        </cache>
      </caches>
    </caching>
    

    Any help would be appreciated!

Please Sign in or register to post replies

Write your reply to:

Draft