How to create a link blob in PHP?

Asked

Viewed 465 times

0

Hi! Well, I’m creating a video site I’m having a problem to play the videos, I put the videos in mysql and I want to play them, I did not find any way to play them malleably. The only way I could was like this: https://playex.link/painel/upload/test.php?id=426612290166

Do you know how I can create a link to tag ?

Example:

<video src="blob://playex.link/v/2389akjf0-12kjr-1ed22=d123-2sed1"/>
  • when you say you want to put a link, what do you really mean? Transform the test.php?id=426612290166 friendly way? Would that be?

  • No, I am wanting to create a link to my video that is in mysql in the form of a blob. This test link I put up is just so you can see how it is so far.

1 answer

2


I know it’s none of my business, but that in the future when your site grows will cause you a lot of headache.

I’ve had problems with this. I was saving music in mysql, I know it gave a very tense overload I had to disable the site for 3 days and pass everything to files, I lost quite users.

if I were you would save everything in folders, example have the file Wesley.mp4 use the function md5() in it, will generate a string 4f755db8796988ecf1a3dba1c0cc584d

after this you use a substr('4f755db8796988ecf1a3dba1c0cc584d',0,2); will return 4f.

with this you create a folder called 4f in php there are functions that create the folder if it does not exist. then it would look like this /uploads/4f/Wesley.mp4 in this case several files may have 4f at the beginning of md5.

then you can save thousands of files in subfolders that won’t get heavy as I did in the image below.

a primeira string do arquivo sempre é a ou 1

the first string of the file is always 'a' or '1', it will sort of group all strings with 1 or a in this folder, currently I have about 700 thousand mp3 files in these folders.

I hope I’ve helped.

  • Whoa, thank you so much! My problem is that I am not allowed to upload files to my hosting and it is very cheap and very, very good indeed! So I am using mysql, in addition I can easily migrate etc... But thank you so much for the idea, I’m 2 months with this problem and I researched a lot, A LOT, if I really can’t use it. Vlw men!

  • thanks for the @Andrei Coelho edition my first reply yet I’m learning to use

  • Good luck friend, I hope you can, I also recommend using mongodb or Elasticsearch to store the video data, in large volume they are very good besides the search interface getting much friendlier

Browser other questions tagged

You are not signed in. Login or sign up in order to post.