Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

290
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda