I have the following code:
<% For Each img In Model.listadoNoticias.Item(0).FOTO
Dim id_LaImagen = "foto_" & img.IdFoto.ToString()
Dim src_imagen = img.RutaFoto.Split("/")
Dim ruta_Foto = Server.MapPath("~") & src_imagen(2) & "\" & src_imagen(3) & "\" _
& src_imagen(4) & "\" & src_imagen(5) & "\" & src_imagen(6) & "\" & src_imagen(7)
Dim fs As System.IO.FileStream = New System.IO.FileStream(ruta_Foto.ToString(), System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read)
Dim LaImagen As System.Drawing.Image
LaImagen = System.Drawing.Image.FromStream(fs)
Dim width_original = LaImagen.Width
Dim height_original = LaImagen.Height
Dim proporcion = width_original / height_original
Dim max_width = 380 * proporcion & "px"
%>
<li>
<img alt="" id="foto_<%:img.IdFoto.ToString()%>"
src="<%:Html.Action("FotoNoticiaString", "Noticias", New With {.id = img.IdFoto}).ToString()%>"
style="max-height:380px;max-width:<%:max_width%>" class="img-responsive centrado_carrusel"/>
</li>
Which I show images in a Carousel Slider, in the I obtain the original dimensions to calculate its proportion, defining a fixed height, and with the proportion to obtain the maximum width or width.
The value of the width ( Dim max_width
) I store it, to assign it to the style of the image, in this case the max-width
, but it tells me that the value is not valid.
I would like to know what would be the correct way to assign the value of Visual to a property of the style of the image. When it is a property that is not of the style, for example assigning it an id, class, etc. of visual, the warning does not indicate me, but in this case yes.