PHP in signatures?
PHP in signatures?
Can you have php in the signature?
I figured with that dynamic image thing you have.
I figured with that dynamic image thing you have.
Re: PHP in signatures?
That's a script that makes the image.
Not actually php in my signature as such.
Not actually php in my signature as such.
Re: PHP in signatures?
http://www.youtube.com/watch?v=qq4OjDdS4eQ
Jacek (BetterPHP) actually has a fantastic tutorial on exactly how the signature is made ^
Basically, as he stated, the script generate the image and he just includes the page
Jacek (BetterPHP) actually has a fantastic tutorial on exactly how the signature is made ^
Basically, as he stated, the script generate the image and he just includes the page
Re: PHP in signatures?
Ah ok. Before I watch it could I do something similar without the youtube api? Like I do something on my site and it creates the image and blablabla?
Re: PHP in signatures?
Yup. The YouTube API is merely how he fetches his last signature made. You could make any number of dynamic signatures with or without the API merely by generating an image on your webpage. The tutorial would not be a lost cause as it explains that piece of things as well, you would just have to apply the information in a new context.
Re: PHP in signatures?
Alrighty then! I'll have a go at it. I guess I just could use the GD library and create an image on my host and then have the filename and img link in my signature
Re: PHP in signatures?
That is about the same principle applied
Re: PHP in signatures?
Oooh!Dylan wrote:That is about the same principle applied
Re: PHP in signatures?
That's exactly what I have doneEcazS wrote:Alrighty then! I'll have a go at it. I guess I just could use the GD library and create an image on my host and then have the filename and img link in my signature
Re: PHP in signatures?
I was expecting something more complicated XDjacek wrote:That's exactly what I have doneEcazS wrote:Alrighty then! I'll have a go at it. I guess I just could use the GD library and create an image on my host and then have the filename and img link in my signature
Re: PHP in signatures?
It was actually much easier than what I though
I thought it would be at least 50 lines of code but for me it ended up with 7
I thought it would be at least 50 lines of code but for me it ended up with 7
Re: PHP in signatures?
Yeah there is really not much to it, PHP is weirdly good at image things, saying that the function names are a bit of a nightmare !
Re: PHP in signatures?
Ye.
Just a question, how can I get parts of the text bold? This is how I'm doing it ATM
Just a question, how can I get parts of the text bold? This is how I'm doing it ATM
Imagettftext($img, 10, 0, $pos_x, $pos_y, $color, 'verdana.ttf', "Testing... 123");
Re: PHP in signatures?
I have a separate font file that is bold, and I split the video title on : (with explode). Then call imagettftext twice
This is the code I use ...
This is the code I use ...
if (str_contains(':', $title)){ $parts = explode(':', $title); $parts[0] = trim($parts[0]) . ':'; $parts[1] = trim($parts[1]); $size = imagettfbbox(11, 0, './fonts/bold_font.ttf', $parts[0]); $width = $size[2] - $size[0]; imagettftext($img, 11, 0, 8, 17, $font, './fonts/bold_font.ttf', $parts[0]); imagettftext($img, 11, 0, $width + 14, 17, $font, './fonts/font.ttf', $parts[1]); }else{ imagettftext($img, 11, 0, 8, 17, $font, './fonts/font.ttf', $title); }
Re: PHP in signatures?
I'm guessing str_contains is a function of yours(?)
And what font are you using? Mine looks all blurry
And what font are you using? Mine looks all blurry
Re: PHP in signatures?
See my "three missing string functions" post in the php code sectionEcazS wrote:I'm guessing str_contains is a function of yours(?)
I have no idea, but you can download them here http://betterphp.co.uk/ext/img/banners/fonts/EcazS wrote:And what font are you using? Mine looks all blurry
Post when you have them, that folder needs to be protected
Re: PHP in signatures?
Got them Thanks!
You could also just use strpos($var, ":") in this case
Edit,
Oh, that function was using strpos
You could also just use strpos($var, ":") in this case
Edit,
Oh, that function was using strpos
Re: PHP in signatures?
yeah, strpos seems like a bit of a un-clean way to do that so I made a function to wrap it until php is fixedEcazS wrote:You could also just use strpos($var, ":") in this case
Edit,
Oh, that function was using strpos