9

I'm looking at implementing context engine and SDL Mobile in a new build.

I see the simplicity of serving the correct image file per device should I have an image from a component imagefield, but if a user embeds a large image file in the middle of an RTF, this is going to be difficult to display.

How have people so far handled this scenario? My leading thought so far is to do some template magic to wrap the image tag with some context tags.

  • Are you trying to deliver the images re-sized using Contextual Image Delivery? – Chris Morgan Jul 28 '14 at 23:00
  • Who or what should control the image resizing logic (authors, template code, or the application)? And do you have any image path naming requirements? – Alvin Reyes Jul 31 '14 at 1:22
  • @ChrisMorgan - yes, we're hoping to use SDL's tools here. – johnwinter Jul 31 '14 at 5:20
  • @AlvinReyes - When an image is entered, it is entered in it's high res state, the CMS functionality handles the rest. – johnwinter Jul 31 '14 at 5:20
7

John - your approach for doing some template magic sounds the right direction. You can replace the image URL with something like

<img src="/cid/scale/<context:Eval runat="server" Expression="ui.thumbnailSize"/>/source/images/snow.png" />

Where ui.thumbnailSize is defined in the context vocabulary as an expression e.g. define

 <aspect name="ui">
   <properties>
     <property name="thumbnailSize" type="Integer" 
       expression="if ( browser.displayWidth lt 640 ) { 50  } else { 100 }"/>

in cwd_engine_vocabulary_conf.xml. Then in cwd_engine_conf.xml define where the source images points to, e.g.

<image>
  <sources>
    <urls>
      <images>http://localhost/images</images>
    </urls>
  </sources>
</image>
| improve this answer | |
  • thanks @ian - just wanted to validate with this community first. – johnwinter Aug 1 '14 at 15:45

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.