Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

291
Vistas
Display Image in Proper Orientation - Blazor Server Side

My page is displaying files from azure storage, some of which are in a landscape orientation while others are in portrait. My issue is that all of the files are displaying as landscape. At first I simply tried to add the following css:

.photo{
    image-orientation: from-image;
}

But it seems like that css is deprecated/doesn't work on edge and chrome.

Next I tried to use blueimp's JavaScript-Load-Image. Which is working to show the image, but the orientation isn't changing - they are all still showing in landscape.

JavaScript:

function RotateImage(fileURL) {
    var loadingImage = loadImage(
        fileURL,
        function (img) {
            document.body.appendChild(img)
        },
        { orientation: true }
    )

    return loadingImage;
}

HTML:

<div class="photosGridDiv">
    @foreach (var file in currentFiles)
    {
        <div>
            @(JSRuntime.InvokeAsync<object>("RotateImage", file.filePath))
            <br />
            <a href="@file.filePath">@file.fileName</a>
        </div>
    }
</div>

How the images look now (the first and second should be portrait): enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Maybe handle rotation on client side, using exif-js(https://github.com/exif-js/exif-js) and apply a CSS transform.

EXIF.getData(imageElement, function() {
    var orientation = EXIF.getTag(this, "Orientation");
    if(orientation == 6)
        $(imageElement).css('transform', 'rotate(90deg)')
});
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda