use Umbraco 7.4.3.
I would like to change the file gallery.cshtml 'Partial View Macro Files' to use the file
imgp8062_big-thumb.jpg instead of imgp8062.jpg file.
imgp8062.jpg the file is very large.
if you use string thumb item.umbracoFile.replace = ("jpg", "_ big-thumb.jpg")
and in 'href put @thumb
I always fail.
The replace function, indexOf, etc. always give error.
What should I add?
The Multi Media Picker create 3 file.
the max dimension of file is 1080px, 500px, 100px.
By default use 1080 pixel.
I want to see the photos from 500px and the link to a photo from 3000px
The function substring , replace,.... don't work.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
Macro to display a gallery of images from media the media section.
Works with either a 'Single Media Picker' or a 'Multiple Media Picker' macro parameter (see below).
How it works:
- Confirm the macro parameter has been passed in with a value
- Loop through all the media Id's passed in (might be a single item, might be many)
- Display any individual images, as well as any folders of images
Macro Parameters To Create, for this macro to work:
Alias:mediaIds Name:Select folders and/or images Type: Multiple Media Picker
Type: (note: you can use a Single Media Picker if that's more appropriate to your needs)
*@
@{ var mediaIds = Model.MacroParameters["mediaIds"]; }
@if (mediaIds != null)
{
<ul class="thumbnails">
@foreach (var mediaId in mediaIds.ToString().Split(','))
{
var media = Umbraco.Media(mediaId);
@* a single image *@
if (media.DocumentTypeAlias == "Image")
{
@Render(media);
}
@* a folder with images under it *@
if (media.Children("Image").Any())
{
foreach (var image in media.Children("Image"))
{
@Render(image);
}
}
}
</ul>
}
@helper Render(dynamic item)
{
<li class="span2">
<a href="@item.umbracoFile" class="thumbnail">
<img src="@item.umbracoFile" alt="@item.Name" />
</a>
</li>
}
If the method Replace() and Substring() does´nt work it sounds like @item.umbracoFile might be null och not of type string. Since you are accessing the item dynamicly, the umbracoFile property should be of the type object, which does´nt have does methods. A simple ToString can fix it. Try the following:
The item.umbracofile exist .
The function replace not exist.
The item.umbracoFile values exist, are the printed values are fine.
Even with your edit does not work.
I found that what does not work. Missing import to top.
gallery
use Umbraco 7.4.3. I would like to change the file gallery.cshtml 'Partial View Macro Files' to use the file imgp8062_big-thumb.jpg instead of imgp8062.jpg file. imgp8062.jpg the file is very large.
if you use string thumb item.umbracoFile.replace = ("jpg", "_ big-thumb.jpg") and in 'href put @thumb I always fail. The replace function, indexOf, etc. always give error. What should I add?
Hi Maioli,
Can you show source code of your partial ?
The gallery file is stardard of Umbraco 7.4.
The Multi Media Picker create 3 file. the max dimension of file is 1080px, 500px, 100px. By default use 1080 pixel. I want to see the photos from 500px and the link to a photo from 3000px The function substring , replace,.... don't work.
the name of file is:
example.jpg example_big-thumb.jpg example-thumb.jpg
Hi Maioli.
If the method Replace() and Substring() does´nt work it sounds like @item.umbracoFile might be null och not of type string. Since you are accessing the item dynamicly, the umbracoFile property should be of the type object, which does´nt have does methods. A simple ToString can fix it. Try the following:
The item.umbracofile exist . The function replace not exist. The item.umbracoFile values exist, are the printed values are fine. Even with your edit does not work.
I found that what does not work. Missing import to top.
is working on a reply...