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 which I obtain the original dimensions to calculate its proportion, defining a fixed height, and with the proportion obtain the width or maximum width.
I store the value of the width ( Dim max_width
) to assign it to the style of the image, in this case to 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 the 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. visually, it does not indicate the warning, but in this case it does.
This is just a warning as per W3C recommendation, the property
max-width:
can only contain values of:examples:
This is not a problem to prevent displaying your page correctly!
Make sure your variable
proporcion
contains a correct value.