Images in CodePen

I was able to do it with cloudinary.

Thank you very much for the reply, I’ll try to post in that manner the next time. :slight_smile:

Thank you so much. I found several ways but none of them was working. I used to click ‘Copy location’ function on images to copy the link but it was not a proper way. Getting link from ‘Inspect Element’ helped me =)

Solution using Github, after a little research:

  1. Create a repository on Github.

  2. Upload the images to your repository

  3. Open the image in Github and turn it into a embeddable version, appending “?raw=true” after the URL, like:

https://github.com/nanquim/freeCodeCampNanquim/blob/master/pauloFreire1.png?raw=true

This will give you a URL you can use in code pen, something like:

https://raw.githubusercontent.com/nanquim/freeCodeCampNanquim/master/pauloFreire1.png

Thanks to:

10 Likes

hey i have a question. I just want to make sure I did it right.
my code that goes in my img element looks like this:

is this correct?

As long as the URL resolves to an image, it’ll show up.

I tried to use DropBox but it doesn’t work as well in Google Drive…
i used gitHub also but i couldn’t find the upload button… can someone confirm if these are still working? Thanks, I appreciate it :slight_smile:

Yes, it is. Jus open your repository:

IT works but unfortunately I can’t use svg files in this way, someone tried used to try svg files on GIThub ?

Thanks a lot! It worked for me too!

Use https://postimages.org/ . Its a free image hosting website that provides every link you need (src).

No one else can see your images

You can sign in and save them to a folder, else if you dont have a link you basically loose access.

1 Like

Good to know I didn’t know this one :wink:

Best idea, thanks so much, worked for me too.

I have been using cloudinary.com for all of my image needs, they have more than enough free storage for the projects.

Just chiming in to point out the obvious: if you have web hosting, you can host your images there. If you don’t have web hosting, it may be a smart idea to find some, since you’re learning to code for the Web and you should probably figure out how to set up domains and namespaces and use cPanel. You don’t have to keep your hosting account forever, you can cancel it, but it might be smart to get a small account for stuff like this :slight_smile:

THanks for the help! Github worked for me too! Nice, quick workaround to avoid a dead link to your image later. I haven’t spent much time on Github yet, as I am just starting out teaching myself. Thanks Again!

HI.
Do you think its ok for a begginer like me if I switch to GitHub ?I finished 111 lesson of free camp and Im starting tribute.

i did it.it works.
thank you.

This was so easy, thank you :slight_smile:

1 Like

Thank you so much. For me this one is the easiest way for now. I have been watching videos on youtube, but your answer and that article made my day :heart:

I’m so glad I found your answer here! The imgur broken links were driving me nuts! I switched over to Google Drive and all is good. Thanks!