10
2 Comments

I finally fixed one of my biggest problems!

Ok for starters, I taught myself code over summer break and created the website https://www.prisimanimations.com/

It's basically a website for learning about and posting animations

One of the biggest obstacles I faced was figuring out a way for people to post their own animations with my page https://www.prisimanimations.com/animations.php

The process:

  1. Originally I had it so people could just upload the file, but the issue with that was that uploads from mobile phone file sizes were extraordinarily huge. Since I'm not a million-dollar company, I had no way of compressing the files.

  2. This meant that the person would have to have the video already uploaded on Youtube for it too work.

  3. With that in mind that lead to two options :

    Have the person upload an embed link - issue with this is it doesn't work from
    mobile & it's kind of complicated (people are lazy)

    Have the person upload the URL link - This is the one I went with, simple & easy

  4. The next image was displaying the video itself (picture below). So to do so I had a generic YouTube logo with an anchor tag that when clicked would take you to the video. The issue is that it's not aesthetically pleasing, which I hated >:(

  5. So today I was fiddling with the code of another page and notice the there's not much of a difference between an embed link and a normal url link

Ex:
Embed - https://www.youtube.com/embed/WGpzPll9U1A"
Normal Ur - https://www.youtube.com/watch?v=WGpzPll9U1A

The only difference is with the "/embed/" and the "watch?v=" in the url

  1. So then I noticed all I have to do is replace the "watch?v=" with the "/embed/", but the new question was how?

My first Idea was using mysqli and uploading the url, searching, then replacing the
"watch?v=" automatically after it was uploaded. This one didn't work out well due to the way the upload system worked.

So then I started searching up ways to replace parts of a string variable and in the short terms figured out you could put the variable through a function, replace what you need to and then upload the result!

And that's what I did and it finally works! The url is automatically changed to an iframe embedded tag! So now the animations uploaded looks 10x better:D

Sorry for the rant, I'm just really excited I finally completed one of my biggest goals since the start of my website!

  1. 2

    Nice work! It’s this kind of thing that makes programming addictive :)

    1. 1

      Yeah, that's what I like about PHP, it's a lot less restrictive :D

Trending on Indie Hackers
How I grew a side project to 100k Unique Visitors in 7 days with 0 audience 49 comments Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 29 comments My Top 20 Free Tools That I Use Everyday as an Indie Hacker 16 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments