How do you share media files between developers?
# help-with-umbraco
r
We don't use Umbraco Cloud. We have installed uSync and the Media items in the back office are controlled from there. I am wondering, do you have any fancy ideas on how to share the files in 'wwwroot/media' between the developers when they work locally so we don't end up with broken images?
k
We use Azure Storage, even for development. Since we use it for production, using it already in development is a good way to verify that everything will work in Azure. We use a separate storage container in the same storage account as the test environment. https://docs.umbraco.com/umbraco-cms/extending/filesystemproviders/azure-blob-storage
r
I thought about that and it is a valid idea. I may look into this UmbracoMediaPhysicalRootPath setting and try to store it in a server shared folder somewhere. Or a folder which is controlled by Google Drive or One Drive and share it among dev. https://docs.umbraco.com/umbraco-cms/reference/configuration/globalsettings
k
My experience with using Windows file shares, Google Drive or OneDrive for "shared development files" is not positive. Never tried it with Umbraco though. The worst one was an internet CIFS file share that required "map network drive"-style activating and would stop working every now and then.
r
I don't have experience with Azure Blob Storage (creating such by myself) What would be the cost of that considering only local development data. I think to have 1 blob which is shared between all our Local instanstes of all projects (~5-10 projects)
m
A bit clunky but could you sync from a central location to the developers local filesystem via buildtargets (copy if not exist)? not bi-directionaly though.. something like (not tested esp not the UNC path but you could always map a drive 🙂) A little win is that you have local media for when not on the office network?
Copy code
xml
<ItemGroup>
    <SourceMediaFiles Include="\\fileshare\Media\**\*.*" />
</ItemGroup>
<Target Name="MEDIA_AfterBuild" AfterTargets="Build" Condition="Exists('\\fileshare\Media\')">
    <Message Text="Copying Media files into Local" Importance="high" />
<Copy Condition="!Exists('$(MSBuildProjectDirectory)\media\%(RecursiveDir)%(Filename)%(Extension)')"  SourceFiles="@(SourceMediaFiles)" DestinationFiles="$(MSBuildProjectDirectory)\media\%(RecursiveDir)%(Filename)%(Extension)" />
</Target>
another gymcrack approach I occasionally use is to just add a urlredirect to the uat/live media (assuming you have environments and your media is populated) and if you need to be adding local media for your tasks add the folder guid exceptions
This one for an older v8 so id media folders but should show the gist.
Copy code
xml
  <rule name="localhost media" stopProcessing="true" enabled="true">
    <match url="(media\/\d+\/.+?)\.(jpg|jpeg|png|gif)" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
      <add input="{REQUEST_URI}" pattern="media\/(1027|1028|1029|1030|1031|1032)\/.+?" negate="true" />
      <!--<add input="{HTTP_HOST}" pattern="^127\.0\.0\.1(:\d+)?$" />-->
      <add input="{HTTP_HOST}" pattern="^localhost(:\d+)?$" />
    </conditions>
    <action type="Redirect" url="https://{UAT|PRODUCTION URL}/{R:0}" appendQueryString="true"/>
  </rule>
final thought.. https://www.goodsync.com/ 🙂
k
Storage is cheap, but if you're not using Azure at all right now then I guess it doesn't really make sense. I would probably put the media in source control as a plan B. 🙂
40 Views