Now, in this case it doesn't work. I've even tried uploading a new picture, nothing. I've seen that some have had a similar issue in earlier version, solved simply by saving the image again, but still nothing.
I haven´t heard of any work-around, how to solve this, and sometimes the work-arounds, will be placed on the case in the issue tracker.
But you could vote for it and make a comment on the issue, so the HQ is aware that there are other that experience the same with the GetMedia on Umbraco 7.1.9
There is no workaround if you want to use XSLT. Otherwise you could try to use Razor instead. As long as macroes are kept seperate you can easily use XSLT and Razor macroes in the same project. However it can be a bit confusing to keep track of the different technologies being used though.
But using Razor might be the way forward if you need to get something finished and ready for deploy quickly since there is no official timestamp for a fixed version.
I'll try to have a look at Razor, although my previous experience with it tells me it will take me a million hours to make a simple script work :) Maybe I can get things working faster using .net c# :)
Well I'm not a big Razor wizard and I prefer XSLT as well. But the Razor implementation has got a lot better in v7 than it was in earlier releases. 6 was fine too.
And since Razor is a subset of c# I'm sure you'll figure it out pretty quickly :)
Ok, I threw something together that works as a temporary work-around. It's not pretty, but it'll do until a fix has been made.
I made some .net implemented as a usercontrol, here's the codebehind:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Profile;
using System.Xml;
using System.Xml.XPath;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.media;
using umbraco.cms.businesslogic.member;
using umbraco.cms.businesslogic.web;
using Umbraco.Web;
using System.Web.Security;
using umbraco.presentation.nodeFactory;
using System.Runtime.Remoting;
using System.Web.Script.Serialization;
namespace WebApplication2.Usercontrols
{
public partial class MediaGet : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
Page.Validate();
if (Page.IsValid)
{
int mediaId = Convert.ToInt32(Request.QueryString["id"]);
Media file = new Media(mediaId);
string url = file.getProperty("umbracoFile").Value.ToString();
Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
Response.Write("<nodes>");
Response.Write("<url>");
Response.Write(url);
Response.Write("</url>");
Response.Write("</nodes>");
}
}
}
}
7.1.9: GetMedia returns empty string
This is driving me crazy. I'm setting up a website with version 7.1.9, the first one. I have a page (id 1050) with an image (media picker).
Normally it should be pretty easy to get the image via something like:
Now, in this case it doesn't work. I've even tried uploading a new picture, nothing. I've seen that some have had a similar issue in earlier version, solved simply by saving the image again, but still nothing.
When I try
I get the right id for the image (1070 with the first image, 1078 with the second image). When I try
all I get is an empty string. I've even tried
but still no xml output. And in the Media section all looks normal.
Please, help!
/Bruno
Hi Bruno,
It´s a known bug in Umbraco 7.1.9 take a look at this issue http://issues.umbraco.org/issue/U4-5925 and vote for it.
/Dennis
Hi Dennis
Ok, done. And there's no work-around until it's solved?
/Bruno
Hi Bruno,
I haven´t heard of any work-around, how to solve this, and sometimes the work-arounds, will be placed on the case in the issue tracker.
But you could vote for it and make a comment on the issue, so the HQ is aware that there are other that experience the same with the GetMedia on Umbraco 7.1.9
/Dennis
Hi Dennis
Ok, thanks. Voted and commented
/Bruno
Hi Bruno
There is no workaround if you want to use XSLT. Otherwise you could try to use Razor instead. As long as macroes are kept seperate you can easily use XSLT and Razor macroes in the same project. However it can be a bit confusing to keep track of the different technologies being used though.
But using Razor might be the way forward if you need to get something finished and ready for deploy quickly since there is no official timestamp for a fixed version.
In the documentation for the image cropper you can see some Razor examples showing how to fetch images as well http://our.umbraco.org/documentation/Using-Umbraco/Backoffice-Overview/Property-Editors/Built-in-Property-Editors-v7/Image-Cropper
Hope this helps.
/Jan
Hi Jan
I'll try to have a look at Razor, although my previous experience with it tells me it will take me a million hours to make a simple script work :) Maybe I can get things working faster using .net c# :)
/Bruno
Hi Bruno
Well I'm not a big Razor wizard and I prefer XSLT as well. But the Razor implementation has got a lot better in v7 than it was in earlier releases. 6 was fine too.
And since Razor is a subset of c# I'm sure you'll figure it out pretty quickly :)
/Jan
Ok, I threw something together that works as a temporary work-around. It's not pretty, but it'll do until a fix has been made.
I made some .net implemented as a usercontrol, here's the codebehind:
I then just call the page /mediaget/
Then I made an XSLT-makro, like this:
The copy-of is just to show me that it works :)
Hope this can assist others while waiting for an actual fix :)
/Bruno
Hi Bruno,
There have been made a pull request now for fixing the issue with the GetMedia in XSLT.
See this https://github.com/umbraco/Umbraco-CMS/pull/587 and http://issues.umbraco.org/issue/U4-5925
/Dennis
Hi Dennis
Thanks for the update :)
/Bruno
is working on a reply...