Keyboarding
Regular Member
- Jan 20, 2014
- 201
- 34
Went through hell and back last night,
Had the worst kind of moment,
I had the code for adding all the images of a folder, I found it on stack,
but I wanted to only add 1 picture, and I did not want to keep calling the same pic.
I googled how to add random images from a folder in php, and so many tutorials came up, some were advanced and complex scripts, and others were only ~4
lines of code.
I tried a few different methods but there was just something I was doing wrong when using any of them and I kept getting errors.
I finally went to stack and got help by asking my own Question.
I probably spent 2 hours, extremely frustrating.
However, it works now.
I also realized if I could do it with images, I could do it with text.
Using the code I found for the images, I modified it to find and read text files that I created in a new folder within my directory.
I styled the txt files so there is variation, it's kind of like using The Best Spinner in a way.
The only problem I'm having now is
- keeping the text where I want it, I'm pretty sure I know how but it's hard to test because
- I think i'm overloading Phpstorm lol, it's getting to the point where every time I refresh it gets stuck in loading again, and I have to reset the connection for it to work when I refresh/use the motiVATOR.
-- It's stuck atm which is why I decided to make an update quick.
Next:
Adding Videos
Adding Music
-- Pull in from youtube, and I'll try soundcloud. i haven't tried it yet but This shouldn't be hard,
Youtube already has embed code,
so i'd set the elseif (($motiv > 50) && ($motiv <200)){
include ("YTmotiv.php");
}
YT.motiv would simply be a div containing the embed code.
OR!
Maybe I'd just create more text files with the code that I would have for one video, this way I can add multiple videos.
... TBS methods lmao.
Glad I typed this out.. the next update should be when I finish it,
Had the worst kind of moment,
I had the code for adding all the images of a folder, I found it on stack,
but I wanted to only add 1 picture, and I did not want to keep calling the same pic.
I googled how to add random images from a folder in php, and so many tutorials came up, some were advanced and complex scripts, and others were only ~4
lines of code.
I tried a few different methods but there was just something I was doing wrong when using any of them and I kept getting errors.
I finally went to stack and got help by asking my own Question.
I probably spent 2 hours, extremely frustrating.
However, it works now.
I also realized if I could do it with images, I could do it with text.
Using the code I found for the images, I modified it to find and read text files that I created in a new folder within my directory.
I styled the txt files so there is variation, it's kind of like using The Best Spinner in a way.
The only problem I'm having now is
- keeping the text where I want it, I'm pretty sure I know how but it's hard to test because
- I think i'm overloading Phpstorm lol, it's getting to the point where every time I refresh it gets stuck in loading again, and I have to reset the connection for it to work when I refresh/use the motiVATOR.
-- It's stuck atm which is why I decided to make an update quick.
Next:
Adding Videos
Adding Music
-- Pull in from youtube, and I'll try soundcloud. i haven't tried it yet but This shouldn't be hard,
Youtube already has embed code,
so i'd set the elseif (($motiv > 50) && ($motiv <200)){
include ("YTmotiv.php");
}
YT.motiv would simply be a div containing the embed code.
OR!
Maybe I'd just create more text files with the code that I would have for one video, this way I can add multiple videos.
... TBS methods lmao.
Glad I typed this out.. the next update should be when I finish it,
Last edited: