CodeWalrus

Development => Web => Topic started by: DarkestEx on December 20, 2015, 10:14:58 PM

Title: Dynamically generated GIF scrolltext
Post by: DarkestEx on December 20, 2015, 10:14:58 PM
Heya!

I was recovering the dynamic GIF generator for scrolling images that I wrote a few months back to generate my signature image on the fly.
Today I reworked the PHP script some more, made it even messier, but added a lot of new features. I will clean the code up one day.
I also changed my avatar to a dynamically generated version. If anybody wants to have a custom bar inside their signature or an animated avatar, I would love to help.
Those who want an avatar can give me a font and a background image, tell me the remaining settings and I will create them a dynamically changing avatar or one that is generated once that they can download.
At some point will I release the code or create a service for these images.

I hope you like them :)
Title: Re: Dynamically generated GIF scrolltext
Post by: p4nix on December 20, 2015, 10:22:05 PM
Really cool plans and really cool stuff you've made. How is it working exactly under the hood? Too lazy to dig into your webserver...
Title: Re: Dynamically generated GIF scrolltext
Post by: kegwaan on December 20, 2015, 10:22:57 PM
So where to I go to ask for one?
Title: Re: Dynamically generated GIF scrolltext
Post by: alexgt on December 20, 2015, 11:08:29 PM
Quote from: kegwaan on December 20, 2015, 10:22:57 PM
So where to I go to ask for one?
I would say here ;)

That is really cool DarkestEx, I am going to stay with Iron Ninja Fancy Stache Man though :P
Title: Re: Dynamically generated GIF scrolltext
Post by: Yuki on December 21, 2015, 12:11:20 AM
That looks quite nice, can I have the code?
Title: Re: Dynamically generated GIF scrolltext
Post by: DarkestEx on December 21, 2015, 12:51:56 AM
Quote from: p4nix on December 20, 2015, 10:22:05 PM
Really cool plans and really cool stuff you've made. How is it working exactly under the hood? Too lazy to dig into your webserver...
It has multiple modes. The text always scrolls, but the background might stay or move too. To generate the frames, the whole string is drawn first and cut into the individual frames. Then the frames are compiled into a gif and cached. The animation is only generated after a few hours or if I force it to rebuilt it. It is configured over an extensive config file.
PHP is the programming language. The .gif extension is archieved using Apache's .htaccess config

Quote from: kegwaan on December 20, 2015, 10:22:57 PM
So where to I go to ask for one?
Just PM me and discuss what features it should have, what font and background and if it should change or stay the same.
I can host it for you if you need it to be dynamic (e.g. countdown or often changing text). We can even read in RSS feeds and refresh the image on new updates.

Quote from: alexgt on December 20, 2015, 11:08:29 PM
Quote from: kegwaan on December 20, 2015, 10:22:57 PM
So where to I go to ask for one?
I would say here ;)

That is really cool DarkestEx, I am going to stay with Iron Ninja Fancy Stache Man though :P
Sure, but maybe a bar inside your signature could be cool ;)

Quote from: Juju on December 21, 2015, 12:11:20 AM
That looks quite nice, can I have the code?
Yes, I will PM you the preliminary code.
Title: Re: Dynamically generated GIF scrolltext
Post by: alexgt on December 21, 2015, 12:55:37 AM
Yeah, I will think on what to put inside, could you get the Internets I have and display them as an example (the bar doesn't work very well it says I have 14 when I actually have 16 xD)
Title: Re: Dynamically generated GIF scrolltext
Post by: DarkestEx on December 21, 2015, 12:57:21 AM
Quote from: alexgt on December 21, 2015, 12:55:37 AM
Yeah, I will think on what to put inside, could you get the Internets I have and display them as an example (the bar doesn't work very well it says I have 14 when I actually have 16 xD)
Yes, I can display your internets count whereever you want and even change it.
Title: Re: Dynamically generated GIF scrolltext
Post by: Yuki on December 21, 2015, 01:00:01 AM
Heh, thanks.

Quote from: DarkestEx on December 21, 2015, 12:51:56 AM
The .gif extension is archieved using Apache's .htaccess config
Or you stick a ?ext=.gif at the end, would work as well.
Title: Re: Dynamically generated GIF scrolltext
Post by: DarkestEx on December 21, 2015, 01:03:49 AM
Quote from: Juju on December 21, 2015, 01:00:01 AM
Heh, thanks.

Quote from: DarkestEx on December 21, 2015, 12:51:56 AM
The .gif extension is archieved using Apache's .htaccess config
Or you stick a ?ext=.gif at the end, would work as well.
Yea sure, but actually I wouln't even need the .gif. .php works fine as I am sending the gif content type.
Title: Re: Dynamically generated GIF scrolltext
Post by: alexgt on December 21, 2015, 01:13:22 AM
Quote from: DarkestEx on December 21, 2015, 12:57:21 AM
Quote from: alexgt on December 21, 2015, 12:55:37 AM
Yeah, I will think on what to put inside, could you get the Internets I have and display them as an example (the bar doesn't work very well it says I have 14 when I actually have 16 xD)
Yes, I can display your internets count whereever you want and even change it.
Awesome ;)

I will PM you when I give it a bit more thought  :thumbsup:
Title: Re: Dynamically generated GIF scrolltext
Post by: Dream of Omnimaga on December 21, 2015, 04:40:05 AM
I like your new avatar DarkestEx. You should make a random :walrii: scroll inside the text.
Title: Re: Dynamically generated GIF scrolltext
Post by: DarkestEx on December 21, 2015, 05:52:44 AM
Quote from: DJ Omnimaga on December 21, 2015, 04:40:05 AM
I like your new avatar DarkestEx. You should make a random :walrii: scroll inside the text.
Oh yea, that'd be nice
Title: Re: Dynamically generated GIF scrolltext
Post by: alexgt on December 21, 2015, 02:47:08 PM
Can you make it scroll rally fast?
Title: Re: Dynamically generated GIF scrolltext
Post by: c4ooo on December 21, 2015, 03:52:55 PM
I dont understand why the browser wont just cache it ???
Title: Re: Dynamically generated GIF scrolltext
Post by: Dream of Omnimaga on December 24, 2015, 07:39:43 AM
I assume it's because it's dynamically-generated? One other issue could be the file size, though, but in Darkest's case his avatar is under 300 KB.

Btw, try to not make your text too long if you ever use such avatar. Even 300 KB is a bit large for an avatar, especially on 3G, but it's tolerable. But smaller is better whenever possible. I wonder if adding the Walrii would make it larger?
Title: Re: Dynamically generated GIF scrolltext
Post by: c4ooo on December 25, 2015, 01:07:09 AM
Quote from: DJ Omnimaga on December 24, 2015, 07:39:43 AM
I assume it's because it's dynamically-generated? One other issue could be the file size, though, but in Darkest's case his avatar is under 300 KB.
Yes but how does it know that? I would presume the browser just caches every thing except php files.
@DarkestEx
Title: Re: Dynamically generated GIF scrolltext
Post by: DarkestEx on December 25, 2015, 01:19:43 AM
Quote from: c4ooo on December 25, 2015, 01:07:09 AM
Quote from: DJ Omnimaga on December 24, 2015, 07:39:43 AM
I assume it's because it's dynamically-generated? One other issue could be the file size, though, but in Darkest's case his avatar is under 300 KB.
Yes but how does it know that? I would presume the browser just caches every thing except php files.
@DarkestEx
Well the PHP page generates the image every few hours or when its force refreshed.
The browser has no idea that the image is actually auto generated as the PHP makes it look just like a normal image. PHP files are (as long as the server works correctly) never sent to the actual visitor of the website or their browser. They get executed on the webserver.
Title: Re: Dynamically generated GIF scrolltext
Post by: c4ooo on January 01, 2016, 06:40:34 AM
sorry if i seem bothersome, but I still dont understand. Why wont the browser just chache the first image that was generated just like it would a static file? Or is the extension of that image literally .php?

Also, i was hoping your profile picture would go into negative numbers, but unfortunately it doesn't XD
Title: Re: Dynamically generated GIF scrolltext
Post by: DarkestEx on January 01, 2016, 12:32:00 PM
Quote from: c4ooo on January 01, 2016, 06:40:34 AM
sorry if i seem bothersome, but I still dont understand. Why wont the browser just chache the first image that was generated just like it would a static file? Or is the extension of that image literally .php?

Also, i was hoping your profile picture would go into negative numbers, but unfortunately it doesn't XD
Well browsers do cache images on their own, but as many people visit this page, every time my avatar is downloaded by the browser from the internet, it produces a big page load on my side. Every time the image is loaded from the web, the php script I wrote is called. It checks if there is new content or if the image is for any reason outdated. If not, the last generated image is sent. If the image needs to be refreshed, the last image is deleted and a new one is generated and saves to disk.

Haha, I used abs in the first place but after new year I changed it to new, static slogan.
Title: Re: Dynamically generated GIF scrolltext
Post by: Dream of Omnimaga on January 01, 2016, 10:10:44 PM
I always wondered how to make a php script or image on a web server force refresh every few minute or so or when it changed, because when I change the site logo or edit the theme, it can take months before users see the changes.
Title: Re: Dynamically generated GIF scrolltext
Post by: DarkestEx on January 02, 2016, 01:26:52 AM
Quote from: DJ Omnimaga on January 01, 2016, 10:10:44 PM
I always wondered how to make a php script or image on a web server force refresh every few minute or so or when it changed, because when I change the site logo or edit the theme, it can take months before users see the changes.
Doing that is very simple. For CSS, there are a few easy solutions too.