Firebase Functions emails with images where to store - google-cloud-functions

I want to send emails to my customers with firebase functions. In this emails I would like to display my logo but where do I need to put my image file (company_logo.png) so that I can use it in my function later and how do I access the image file?
I currently have my logo image (.png) directly in the firebase functions folder but for sure this does not work...
Please find a snippet of my code below
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>
<style>
body {
font-family: 'Poppins';
}
</style>
</head>
<body style="background-color:#EEEEEE;font-size:20px;color:black;">
<div style="text-align:center;margin-top:3em;margin-bottom:3em;">
<img src="company_logo.png" alt="company logo" style="width:200px;height:52px;">
</div>
...

You can put your image on a storage bucket and grant public read access to the image. After that, access your image by using an API link as it does not require authentication. For example:
<img src="https://storage.googleapis.com/BUCKET_NAME/company_logo.png" alt="company logo" style="width:200px;height:52px;">

Related

How to connect a discord bot to a website

How can I connect my Discord bot to my HTML website?
I don't need a dashboard. I just need to show how many servers my bot is in. On my website, how can I do this and which backend language should I use?
Which is the best backend language for web development?
My HTML content:
<!DOCTYPE html>
<html>
<head>
<div class="topnav">
<a class="active" href="#home">Home</a>
News
Contact
About
</div>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Beast Bot</title>
</head>
<body>
<div class="container">
<div class="title">
<P>Beast Bot :)</P>
<img class="img" src="images/kisspng-portable-network-graphics-computer-icons-transpare-braingoodgames-5c9d9c5093e378.8617067815538330406058.png">
</div>
</div>
</div>
</body>
</html>
I would use client.guilds.size to get the amount of servers it's in. Assuming the web server and the bot are on the same server then, I would write the raw count of the amount of servers it's in to a file that the public can access from a browser.
Using jQuery (by adding <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> to your head) you can do a GET request to the publicly accessible URL that has that number, like this:
$.get("/path/to/data", data => {
// Your code here to display it. The data variable will have the page's content
})
You can use an API to fetch data from your bot's back end. Frameworks like Express.js are great for making a REST API from scratch.

How can I insert a good reads logo into an html page?

I'm a beginner, alright?
I'm trying to build an HTML page that needs social media logos. I have all the ones I need except for good reads.
https://www.goodreads.com/
I can't find how to build one in CSS. I've tried to copy the image, that doesn't work. Does anyone else know how to build a goodreads tag?
you can download a goodreads svg at Goodreads, open the file in your editor, copy the content and put it where you need it in your HTML file.
On goodreads.com, copy the image address and paste in into a new tab. If the new tab contains only the image, copy the image address again and paste it between the src tabs. Otherwise, keep copying the image address from the new pages.
Depends if you want to just put in the logo or make the logo a link to your goodreads account
For just the image you could use
<html>
<head>
<!--Put your metadata and link css here-->
</head>
<body>
<img src="https://i.stack.imgur.com/g0KBL.png" alt="Goodreads">
</body>
</html>
And for a social media link I recomend using a icons library like FontAwesome
<html>
<head>
<script src="https://kit.fontawesome.com/393a279287.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="fa fa-goodreads"></div>
</body>
</html>
Anyways good luck!

Why aren't my images displaying properly in HTML?

For some reason, my images are not loading in on my HTML document. I checked the link, and they are all valid. If I command click them it brings up the picture. I am not sure what else to do..
Here is the entire code of the website:
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" href="/Users/evanmullen/Public/images/favIcon.ico">
<title>Algobyte</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght#100&display=swap" rel="stylesheet">
<link rel="stylesheet" href="stylesheet.css">
</head>
<body style="background: #efefef;">
<div class="header" id="mainHeader">
<img src="Users/evanmullen/Public/images/cover.png" alt="algobyte logo" width="20%">
</div>
<div class="app-section">
<h3>Apps</h3>
<!--QuickrTippr-->
<p class="center">
<a href="https://apps.apple.com/us/app/quickrtippr/id1551206999">
<img src="Users/evanmullen/Public/images/WebsiteQuickrTippr.png" alt="QuickrTippr picture" width="20%" class="app-picture"></a>
<!--Identicryst-->
<img src="/Users/evanmullen/Public/images/WebsiteIdenticryst.png" alt="Identicryst picture" width="20%" class="app-picture">
</p>
</div>
<div class="about-us">
<h3>About Us</h3>
<img src="Users/evanmullen/Public/images/bridge.jpg" alt="Bear Mountain Bridge, Cortlandt, NY" width="100%" class="center">
<p class="center">
We are a Hudson Valley, New York based software development company that strives to produce the highest quality software.
</p>
</div>
</body>
</html>
I am using Firebase as my host.
Ok so this is a pretty common thing. It's not displaying because with the instructions you gave your file, the browser cannot find the image....heres what I do...I assume your using VS due to your tag, so inside the folder that your project is made in, upload or open the images you want to the same folder your index.html project is in. Once the images are in the same folder you can just change the name of your images to src="imagename.png" or jpeg or whatever you use. If you dont want the images in the same folder, then just save them to another folder but in the same root folder of your project and copy the relative path name by right clicking and selecting "Copy relative path" and incude that in your image element..it will look somthing like this...src="projects/image.png". I hope that explains it and solves your issue. Happy coding!
<a href="https://apps.apple.com/us/app/quickrtippr/id1551206999">
example ------> if in same folder as index.html <img src="sophoto.png" alt="QuickrTippr picture" width="20%" class="app-picture"></a>

Why will my .png website logo file not show up on my website?

I am trying to create a custom logo for my website through a .png file, as soon as I type in the code and test run it through local host, the file does not display the logo image.
Renaming the .png file
Checking for spelling
Checking for capitalization
Tried adding a "-" inbetween ("holyland-logo.png")
Tried adding a color brown ("images/brown-holylandlogo.png")
<html>
<head>
<title>HolyLand Souveniers</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="top-nav-bar">
<div class="search-box">
<img src="images/holylandlogo.png" /> (This is causing the issue)
<input type="text" class="form-control">
<!--This is a search box -->
<span class="input-group-text"><i class="fa fa-search"></i></span>
<!--Search Icon -->
</body>
</html>
I expected the logo to appear on the top left of the website, but is it not doing anything, is it only giving me an X with no .png logo picture.My file pathing and folders as requested in the comments
If you don't put an / at the beginning of the image URL (relative path) the server expect to have the images folder next to your index point (index.html/php) but if you put one at the beginning (absolute path) it tries to go from the root of your Apache/nginx. Just to clarify.
In your case that means, you need to make sure the images' folder is next to your index.html or index.php.
Another tip: avoid spaces between the = in HTML and place your style after external styles in case you want to override parts of those.
But please give us more information about your environment, so we can help better:
Where is you site hosted (locally/provider)
Which is the URL you tried to access or file
Your folder structure
Your setup (OS, apache/nginx, PHP...)
According to your screenshot the HTML file and the PNG file are in the same folder, so your file path is wrong: In the img tag, instead of src="images/holylandlogo.png" just write src="holylandlogo.png" .
I've clicked on your public link and looked at my Chrome console logs:
Failed to load resource: the server responded with a status of 404 (Not Found)
for following resources:
style.css
holylandlogo.png
favicon.ico
https://apollo.waketech.edu/~smbannoura2/holylandlogo.png shows the image, so
<img src="holylandlogo.png">
should work for your html page.
For style.css and favicon.ico, check the file path as suggested in previous answers
I solved the problem by adding <img src="holylandlogo.png"> instead of what i originally had <img src="images/holylandlogo.png" /> since i had the logo in the same file. Thanks to a reply in the comment that Esdee stated. For more details you can read throughout the post on what other things i tried.
you need to put the images folder with the image in the source files of your website. Otherwise, use the original website link for the image

Send images in the mail body from unix

I am trying to send an image through html coding
<!DOCTYPE html>
<html>
<body>
<style>
body {background-color:blue}
</style>
<h1>hello</h1>
<h4>hello</h4>
<center>
<img src="C:\Users\dubasir\Desktop\New folder\we.jpg" width="1200" height="800">
</center>
This is a linking
<p>jfklkskflksdlfklsdmklm</p>
</body>
</html>
how to run it unix and get the image in mail body.
You're using an absolute Windows file name for the image. This can't work - the receiving computer has no way to know where on the world that image is stored.
Instead, you need to attach the image to the mail. Give it a name, say we.jpg. Now you can use this HTML code to use it in the mail body:
<img src="cid:we.jpg" />
Here us an example how the raw mail would look like: Can an HTML email body reference a file sent as an attachment (in the same email)?
i believe you forgot to end the image tag, this is done as follows:
<img src="path/blah.jpg" height="100" width="100"/>
that slash before you end the tag is needed to close the image tag