I have a content type with a MediaPicker field in it. The MediaPicker allows the contributor to select an image for the content type. I'm using Projector to develop a page that renders a list of this content type, but the image doesn't display. I modified the "Rewrite Results" in the layouts for the Projector to write the field to an image: <img src="{Text}"/>
But this produces: <img src="~/Media/.../picture.jpg"/> and doesn't convert the tilde ~/ to the correct path.
Can you tell me what I'm doing wrong? What is the best way to render an image using the Projector module?
Thanks!
I posted on my blog a solution that resolves this issue:
http://coderkelly.wordpress.com/2012/04/18/solved-projector-module-layout-to-display-media-picker-field-as-image/
Related
Is it possible to remove/disable the selection of the Image Rendition when selecting a picture in a custom content type?
Any User/Contributer should not be able to choose the image Rendition because it happens programmatically in the Display Template. The Picture must always be choosen as Full Size Image!
Has anyone an idea how i can set this up?
As i remember Image Renditions are implemented using query string params so you can always ignore provided by user image rendition and override it in your display template.
I imported the picture in the Item_Custom.html Template (masterpages\Display Templates\Cotrol Web Parts\Item_Custom.html) like I did in the other Templates:
<mso:ManagedPropertyMapping msdt:dt="string">'Category Image'{Category Image}:'MyCategoryImageOWSIMGE',' .... </mso:ManagedPropertyMapping>
Then Set the JS Variable:
<!--#_
var CategoryImage = $getItemValue(ctx, "Category Image");
_#-->
And manually set the Rendition ID, no matter what was choosen by the user:
<img style="visibility: visible;" src="_#= CategoryImage =#_?RenditionID=7" id="CategoryImage" onload ... >
I use MODx Revolution. On the home page we show some of the excerpt of the content (introtext).
<h2 class="title">[[+pagetitle]]</h2>
<p>[[+introtext]]</p>
<p class="postmeta">
read more
| <span class="date">[[+publishedon:strtotime:date=`%m/%d/%y`]]</span>
</p>
This is the guide I've used.
how display on the main page as the first image of the article?
You need to make a Template Variable eg 'BlogImage' of type 'Image' and assign that TV to your blog post template. Then upload your image to that field within each blog post and you can then access it with:
img src="[[+tv.BlogImage]]"
That will output your image from the TV.
To output this image on a different template EG your homepage template you need to do a GetResources or GetResourceField call, which requires the installation of packages through the Revo Package Manager.
hope that helps.
I would like to be able to specify exactly where a ContentPart is rendered in a view.
For example, in my Content.Summary.cshtml I want to wrap my title and first image from the gallery (I'm using ZenGallery) in an anchor tag. I thought I would be able to do it like this but the gallery template is not rendered.
<a href="#Url.ItemDisplayUrl((IContent)Model)">
<h2>#Model.ContentItem.TitlePart.Title</h2>
#Display(Model.ContentItem.ZenGalleryPart)
</a>
But if I do the following then the gallery template (ZenGallery.Summary.cshtml) is shown along with all other parts.
#Display(Model.Content)
I understand that the recommended way to do this is probably using Placement.info, is that right? But this way makes more sense to me and would allow for more fine grain control of the end markup. How could I achieve the markup I'm looking for?
This should give you a pretty good start on doing precisely what you want: http://weblogs.asp.net/bleroy/archive/2011/07/31/so-you-don-t-want-to-use-placement-info.aspx
I am using Orchard 1.4 and playing around with the Projection Widget.
One thing I am wondering about is how to control the positioning of the content on the Page.
I understand the widgets are placed in the designated zone, but what if I want to put the contents of the projection modules somewhere within the page content?
For Example :
Title
Some Page content here
Projection Module content
Some more Page content here
How do I do that?
Thanks!
You typically use placement.info to change the order of parts on the rendered page.
When a list item has an attachment, SharePoint automatically renders a paperclip image for that particular row, which indicates that the item has an attachment. Is there any way to change the image that is rendered?
The site is in a shared hosting environment, so I can't simply replace the image on the file system. Also, there are other lists that are part of the same site that should use the default image.
Is there any way to change the image that is rendered for items with an attachment on an individual list basis?
EDIT: Following is the HTML that is rendered:
<td class="ms-vb2">
<img align="absbottom" src="http://devsandbox/_layouts/images/attach.gif" alt="Attachment"/>
</td>
The only real way you'll be able to do this is to use jQuery (or some other javascript library). You'll need to locate the elements you want to update on the page and change the URL's
$('img[src*=attach.gif]').each(function() {
$(this).attr('src', '/path/to/new/image.png');
}
My jQuery may be a touch wrong but that should be near enough to give you an idea of what to do
Edit - The best way to have this down would be via a custom WebPart which renders the JavaScript. This way it can easily be dropped into any page you want
i don't know which element off the top, but I would look for it in one of the stylesheets and use SharePoint designer to do the replacement work for a specific list.
Use Firebug to inspect the element that you want to revert. This will tell you the css class and other properties used by that element. Then write your own class and add it to the core.css file or if you want, add it to the css for the Site/Site Collection through the MasterPages link in Site Settings.
EDIT
I used firebug to look at an image in SharePoint and here is how it is rendering.
<img id="img_1-2_" class="rpo-gif rpo-gif-2" border="0" style="padding: 0px;" alt="Expand/Collapse" src="/_layouts/images/minus.gif"/>
As you can see it is using a class and setting a src to '/_layouts/images/minus.gif'. Well you can go find that file in the 12Hive directory and then replace it with an image of your choice that has the same name.