5
I’ve been going through some websites and the ones that use SVG logos usually put them in a file separately. This brings the practicality of when you change the file, on all pages it changes, but you make an additional request.
Is it a good idea instead of calling the image, to insert it directly into HTML? About the practicality I quoted above, it could be easily bypassed with a file called logotipo-svg.php
(or logotipo-svg.html
) that generates the inline SVG code ready to be inserted on the page through a:
echo '<div class="logotipo">' . file_get_contents('logotipo-svg.php') . '</div>';
It is a lot of work to reduce the data transferred? The amount of data to be transferred is reduced?
If you already have the file, it is no longer simple a
<img src='logotipo.svg'/>
than to process on the server and insert on the page?– Renan Gomes
I want to know if it’s worth it not to do it that way, if the amount of data is reduced by cutting that request.
– Rafael Almeida
protip: if you are going to include the file in HTML, and it is a static file, copy and paste it directly into HTML. It is unnecessary to use
file_get_contents
, aka overenginering :)– Emerson Rocha