Interruptor de extensión SVG / PNG
¿Hay alguna forma de usar imágenes SVG en mi sitio y, si los navegadores / dispositivos no lo admiten, cambia la extensión a png? ¿Hay una mejor manera de hacer esto?
Nota: estoy usando el<img>
Etiqueta y modernizr.
Aquí está mi código que escupe las imágenes dinámicamente.
<?php $attachments = attachments_get_attachments(); ?>
<?php if( function_exists( 'attachments_get_attachments' ) ) {
$attachments = attachments_get_attachments();
$total_attachments = count( $attachments ); if( $total_attachments ) : ?><?php for( $i=0; $i<$total_attachments; $i++ ) : ?>
<img src="<?php echo $attachments[$i]['location']; ?>" alt="<?php echo $attachments[$i]['title']; ?>" class="full" />
<?php endfor; ?><?php endif; ?><?php } ?>
Salidas de lo siguiente:<img src="http://mysiteurl.net/image.png" alt="Image Title" class="full wp-image-287" />