1
Friends,
Following the posted examples, I made the adjustments:
public ActionResult ThumbNail(int largura, int altura, string caminhofoto)
{
if (caminhofoto != "caminho" )
{
WebImage webImagem = new WebImage(@caminhofoto).Resize(largura, altura, false, false);
return File(webImagem.GetBytes(), @caminhofoto);
}
return View();
}
This Actionresult above needs to receive Jquery:
<script >
function BuscarCaminho()
{
//Pega o elemento 'select'
var select = document.getElementById("selecao");
//Altera o valor do atributo 'src' da imagem para carregar a imagem selecionada
if (select != "") {
document.getElementById('caminho').src = select.value;
// alert(select.value);
}
}
This is the Altered Jquery, I’m passing the photo path:
<div >
<img id="foto" src="@Url.Action("Thumbnail", "ConsultaCliente", new {caminhofoto = "caminho", largura = 100, altura = 100 })" alt="thumbnail" />
</div>
<label>Foto:</label>
<div id="selecao" onchange="BuscarCaminho()" >
@Html.DropDownList("idFoto", String.Empty)
</div>
At this point, for each selected photo I want to send the image to be viewed on the screen. thanks
I don’t quite understand what you really want to do.
– Erlon Charles
the
onchange
is in a div, and should be in theselect
. Maybe in that case it would be better to usehtml
even instead of the syntaxrazor
.– Richard Dias
Take a look at my answer. If you do not satisfy your need comment that I will modify to try to fit better in what you want to do. for now with your question was what to do according to what I understood.
– Richard Dias