[英]Why does my image link convert to base 64 automatically in visual studio code?
These are the queries I use to fetch the image src in the browser console and I get the desired output:这些是我用来在浏览器控制台中获取图像 src 的查询,我得到了所需的 output:
let logoLink = document.querySelector('div[class="jsx-1935571144 college-info d-flex justify-content-between align-items-center"] > a[class="jsx-1935571144 logo bg-white pointer-none"] > img');
logoLink.getAttribute('src').toString();
OUTPUT: OUTPUT:
https://images.static-collegedunia.com/public/college_data/images/logos/149154157555.jpg?tr=h-80,w-80,c-force
However, when I run the same query in a .js
file in visual studio code, The link is transformed to base64.但是,当我在 Visual Studio 代码中的.js
文件中运行相同的查询时,链接会转换为 base64。
OUTPUT: OUTPUT:
data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==
And this doesn't give me the image I want.这并没有给我想要的图像。 Is there a way to convert this back to an image, I couldn't find any online that work?有没有办法将其转换回图像,我在网上找不到任何有效的方法?
That IS your image.那是你的形象。 It's just BASE64-encoded.它只是 BASE64 编码的。 If you run that string through a base64 decoder, you'll see it starts GIF89a, which is the magic sequence for a GIF.如果通过 base64 解码器运行该字符串,您会看到它以 GIF89a 开头,这是 GIF 的神奇序列。 You just need to decode it.你只需要解码它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.