<div dir="ltr">Not a bug in Mono, you're just sending the wrong mime-type (and the browser isn't recognising that it's an image). image/jpg should actually be image/jpeg.<div><br></div><div style><span style="font-family:arial,sans-serif;font-size:13px">I noticed you're using Nginx, I'd probably use a custom ActionResult that uses the <a href="http://wiki.nginx.org/XSendfile">X-Accel-Redirect header</a> for better performance. This lets Nginx serve the file based on a HTTP header your code returns.</span><br>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 30, 2013 at 2:59 AM, SirNoSkill <span dir="ltr"><<a href="mailto:quandary82@hailmail.net" target="_blank">quandary82@hailmail.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
There is a bug in mono 3.0.1.<br>
I don't know if it is fixed in 3.0.3<br>
<br>
<br>
If in a <a href="http://asp.net" target="_blank">asp.net</a> MVC3 controller, I call File via path (probably uses<br>
FilePathResult)<br>
like this<br>
<a href="http://www.daniel-steiger.ch/gallery/FullImage/001.jpg?no_cache=1358694795000" target="_blank">http://www.daniel-steiger.ch/gallery/FullImage/001.jpg?no_cache=1358694795000</a><br>
<br>
I get the image data as text.<br>
The path is correct.<br>
The mime is correct.<br>
The image itselfs is valid.<br>
<br>
If I call the url to the image directly and not via the "File" method,<br>
then it works<br>
Proof:<br>
<a href="http://www.daniel-steiger.ch/Content/images/gallery/002.jpg?LastWriteTimeUTC=1358694795000" target="_blank">http://www.daniel-steiger.ch/Content/images/gallery/002.jpg?LastWriteTimeUTC=1358694795000</a><br>
<br>
Ironically, generating the thumbnail works (that probably goes via<br>
FileStreamResult).<br>
Both work correctly on windows.<br>
<br>
<br>
PS:<br>
The latest-stable install script for xsp misses copying<br>
fastcgi-mono-server4, mod-mono and xsp  to the 4.5 gac.<br>
Same things applies to Microsoft.VisualBasic.dll.<br>
See here:<br>
<a href="http://stackoverflow.com/questions/4239645/does-the-razor-view-engine-work-for-mono" target="_blank">http://stackoverflow.com/questions/4239645/does-the-razor-view-engine-work-for-mono</a><br>
<br>
<br>
<br>
<br>
namespace Homepage.Controllers<br>
{<br>
<br>
<br>
    public class GalleryController : Controller<br>
    {<br>
<br>
<br>
        protected static string GetImageDirectory()<br>
        {<br>
            string bd = AppDomain.CurrentDomain.BaseDirectory;<br>
            string strImageDirectory = System.IO.Path.Combine(bd,<br>
            "Content");<br>
            strImageDirectory =<br>
            System.IO.Path.Combine(strImageDirectory, "images");<br>
            strImageDirectory =<br>
            System.IO.Path.Combine(strImageDirectory, "gallery");<br>
<br>
            return strImageDirectory;<br>
        } // End Function GetImageDirectory<br>
<br>
<br>
        protected static string strImageDirectory = GetImageDirectory();<br>
<br>
<br>
        public FileResult FullImage(string id)<br>
        {<br>
            string strFileName =<br>
            System.IO.Path.Combine(strImageDirectory, id);<br>
<br>
            //return new FilePathResult("CorrectFullPathAndFileName",<br>
            "CorrectMime");<br>
            return File(strFileName, "image/jpg");<br>
        } // End Action FullImage<br>
<br>
<br>
<br>
        public FileResult Thumb(string id)<br>
        {<br>
            //return Redirect(id);<br>
<br>
            string strFileName =<br>
            System.IO.Path.Combine(strImageDirectory, id);<br>
<br>
            System.IO.Stream ms =<br>
            Tools.Imaging.GetThumbnailStream(strFileName,<br>
            System.Drawing.Imaging.ImageFormat.Png);<br>
            return File(ms, "image/png");<br>
            /*<br>
            using (System.IO.Stream ms =<br>
            Tools.Imaging.GetThumbnailStream(strFileName,<br>
            System.Drawing.Imaging.ImageFormat.Png))<br>
            {<br>
                return File(ms, "image/png");<br>
            }*/<br>
        } // End Action Thumb<br>
<br>
<br>
    } // End Class GalleryController : Controller<br>
<br>
<br>
} // End Namespace Homepage.Controllers<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
  SirNoSkill<br>
  <a href="mailto:quandary82@hailmail.net">quandary82@hailmail.net</a><br>
<br>
--<br>
<a href="http://www.fastmail.fm" target="_blank">http://www.fastmail.fm</a> - Email service worth paying for. Try it for free<br>
<br>
_______________________________________________<br>
Mono-devel-list mailing list<br>
<a href="mailto:Mono-devel-list@lists.ximian.com">Mono-devel-list@lists.ximian.com</a><br>
<a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" target="_blank">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a><br>
</font></span></blockquote></div><br></div>