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

106
Vistas
Open an image in a new tab with only image data URI from PostgreSQL

I'm updating a legacy report which uses Datatables. I need to add a new column showing a thumbnail image, which is clickable, showing the full image in a new tab.

The image data is stored in the PostgreSQL database as BYTEA and supplied to the frontend CONCATenated together as a URI (e.g. "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQA...")

Currently I have the following code...

    self.dataFields = [
        { data: 'some',       title: 'Some',  visible: true },
        { data: 'other',      title: 'Other', visible: true },
        { data: 'guff',       title: 'Guff',  visible: true },
        { data: 'image_file', title: 'Image', visible: true, 
            render: function(data, type, full, meta) {
                return `
                    <a href="` + data + `" target="_blank">
                        <img style='display:block; width:70px;height:70px;'
                             src="` + data + `"/>
                    </a>``;
            }
        },
    ]

This renders a nice thumbnail and opens a new tab, but in Chrome there's no image when you open it. You can see the image data when hovering the mouse over the tab...

enter image description here

If I right-click the thumbnail and "Open in new tab", I see the image data in the address bar...

enter image description here

Is there a way to sort this in Chrome when clicking on the thumbnail?

about 4 years ago · Juan Pablo Isaza
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