Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC3 URL.Action not rendering my image in img tag

I have an image in my view, as:

    <img width="150" height="150" scr="@Url.Action("GetImage", "Item")" />

My controller, ItemController, has this method:

    public FileContentResult GetImage(){
        var model = _itemService.GetItemImage(1);
        if(model != null && model.ImageData != null){
            return File(model.ImageData, model.ImageMimeType);
        }
        return null;
    }

When the view renders, I get the following markup for my image but no image is rendered:

    <img width="150" height="150" scr="/MyApp/ItemManagement/GetImage"/>

If I type this url 'http://localhost/MyApp/ItemManagement/GetImage' in the browser, I get the image. I'm not sure what's wrong with this. Could someone point out what is wrong with my code please?

Thanks in advance. Jeff

like image 914
Jeff Reddy Avatar asked Dec 13 '25 05:12

Jeff Reddy


1 Answers

Image attribute should be src...?

like image 108
Charlino Avatar answered Dec 16 '25 08:12

Charlino