Skip to content

Instantly share code, notes, and snippets.

@5up3rman
5up3rman / GlassMapperScCustom.cs
Last active May 10, 2017 08:12
Live Photo Glass Mapper Sc Custom
public static IDependencyResolver CreateResolver()
{
var config = new Glass.Mapper.Sc.Config();
var dependencyResolver = new DependencyResolver(config);
dependencyResolver.DataMapperFactory.Insert(0, () => new LivePhotoDataMapper());
return dependencyResolver;
}
@5up3rman
5up3rman / LivePhotoMvc.cs
Last active May 19, 2017 18:28
Live Photo - Render the Element
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Web;
using System.Web.UI;
using Glass.Mapper;
@5up3rman
5up3rman / RenderElement.cs
Created May 8, 2017 18:40
Live Photo Render Element
using System;
using System.IO;
namespace Paragon.Foundation.LivePhoto.HtmlHelpers
{
public class RenderElement : IDisposable
{
private readonly TextWriter _writer;
private readonly string _firstPart;
private readonly string _lastPart;
@5up3rman
5up3rman / PropertyExtensions.cs
Created May 8, 2017 18:31
Live Photo Property Extensions
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using Glass.Mapper;
using Sitecore.Collections;
using Sitecore.Diagnostics;
@5up3rman
5up3rman / LivePhotoDataMapper.cs
Last active May 19, 2017 18:42
Live Photo Data Mapper
using System;
using Glass.Mapper;
using Glass.Mapper.Sc;
using Glass.Mapper.Sc.Configuration;
using Glass.Mapper.Sc.DataMappers;
using Paragon.Foundation.LivePhoto.Data.Fields;
using Paragon.Foundation.LivePhoto.Extensions;
using Paragon.Foundation.LivePhoto.GlassFieldObjects;
using Sitecore.Data;
using Sitecore.Data.Fields;
@5up3rman
5up3rman / LivePhotoGlassObject.cs
Last active May 19, 2017 18:25
Live Photo Glass Object
using System;
using Sitecore.Globalization;
namespace Paragon.Foundation.LivePhoto.GlassFieldObjects
{
/// <summary>
/// Based on Glass.Mapper.Sc.Fields.Image
/// </summary>
[Serializable]
public class LivePhotoGlassObject : ILivePhotoGlassObject
@5up3rman
5up3rman / ShowLivePhotoPage.cs
Last active May 19, 2017 18:21
Live Photo + Sitecore
using System;
using System.Web.UI.WebControls;
using Paragon.Foundation.LivePhoto.Extensions;
using Sitecore;
using Sitecore.Configuration;
using Sitecore.Controls;
using Sitecore.Data;
using Sitecore.Mvc.Extensions;
using Sitecore.Resources.Media;
using Sitecore.Shell.Applications.ContentEditor;
@5up3rman
5up3rman / LivePhotoFieldControl.cs
Last active May 18, 2017 20:54
Live Photo + Sitecore
using Sitecore;
using Sitecore.Data.Items;
using Sitecore.Exceptions;
using Sitecore.Globalization;
using Sitecore.IO;
using Sitecore.Resources.Media;
using Sitecore.Shell;
using Sitecore.Shell.Applications.Dialogs.MediaBrowser;
using Sitecore.Shell.Framework;
using Sitecore.Shell.Framework.Commands;
@5up3rman
5up3rman / ShowLivePhoto.xaml.xml
Last active May 18, 2017 20:55
Live Photo + Sitecore
<?xml version="1.0" encoding="UTF-8" ?>
<xamlControls
xmlns:x="http://www.sitecore.net/xaml"
xmlns:ajax="http://www.sitecore.net/ajax"
xmlns:rest="http://www.sitecore.net/rest"
xmlns:javascript="http://www.sitecore.net/javascript"
xmlns:r="http://www.sitecore.net/renderings"
xmlns:xmlcontrol="http://www.sitecore.net/xmlcontrols"
xmlns:p="http://schemas.sitecore.net/Visual-Studio-Intellisense"
xmlns:asp="http://www.sitecore.net/microsoft/webcontrols"
@5up3rman
5up3rman / LivePhoto.config
Last active May 18, 2017 20:52
Integrating Apple's Live Photo API into Sitecore
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<controlSources>
<source mode="on" namespace="Paragon.Foundation.LivePhoto.ContentEditor.Fields" assembly="Paragon.Foundation.LivePhoto" prefix="paragon" />
</controlSources>
<pipelines>
<renderField>
<processor type="Paragon.Foundation.LivePhoto.Pipelines.RenderField.GetLivePhotoValue,Paragon.Foundation.LivePhoto"
patch:after="processor[@type='Sitecore.Pipelines.RenderField.GetImageFieldValue, Sitecore.Kernel']" />