Page 1 of 2

Small banner creator

Posted: Sat May 07, 2011 11:02 pm
by EcazS
I was bored and I made a small banner creator, just for fun.

NOTE: I'm going to add more things like, more backgrounds, uploading your own background, fonts, size and stuff like that but that'll come later. I'm also going to add a logout button :lol:

The site might be a little slow the first time, not sure though.
http://ecazs.net/banner/

Username: User1
Password: user1

Re: Small banner creator

Posted: Sat May 07, 2011 11:10 pm
by jacek
Are you sure the password it right ? I don't seem to be able to log in.

Re: Small banner creator

Posted: Sat May 07, 2011 11:11 pm
by EcazS
jacek wrote:Are you sure the password it right ? I don't seem to be able to log in.
Are you typing it right? O:
The password is all lower-case.

Re: Small banner creator

Posted: Sat May 07, 2011 11:12 pm
by jacek
I did it 4 times, but yeah apparently I was typing it wrong :lol:

Re: Small banner creator

Posted: Sat May 07, 2011 11:16 pm
by jacek
Wow, its very pretty ;)

It also seems to work.

It might be nice if you made the form remember what was entered, so people can try different images.

And a font colour option would not be impossible if you are feeling adventurous.

Re: Small banner creator

Posted: Sat May 07, 2011 11:20 pm
by EcazS
Why thank you :)

I was planning on making it "remember" the text just never got around do it.
And I want to add font color options I just don't know how to and I would have to get the RGB values

I could do some text recognition thing (if you enter "red" the text will be red) but that just seems... weird :lol:

Re: Small banner creator

Posted: Sat May 07, 2011 11:25 pm
by jacek
it would be possible if you get them to enter a hex code like #990000, or you might be able to get a "super jQuery colour picker" that can give you the RGB values.

Re: Small banner creator

Posted: Sat May 07, 2011 11:31 pm
by EcazS
But how would I convert the hex into RGB values :? If I can do that I can use a normal hex jquery color picker :lol:

Edit, adding it now :D

Re: Small banner creator

Posted: Sat May 07, 2011 11:49 pm
by jacek
http://php.net/manual/en/function.hexdec.php

As ususal, php makes it very easy :)

Re: Small banner creator

Posted: Sun May 08, 2011 12:58 am
by EcazS
I found a pre-made function,
function HexToRGB($hex) {
		$hex = ereg_replace("#", "", $hex);
		$color = array();
 
		if(strlen($hex) == 3) {
			$color['r'] = hexdec(substr($hex, 0, 1) . $r);
			$color['g'] = hexdec(substr($hex, 1, 1) . $g);
			$color['b'] = hexdec(substr($hex, 2, 1) . $b);
		}
		else if(strlen($hex) == 6) {
			$color['r'] = hexdec(substr($hex, 0, 2));
			$color['g'] = hexdec(substr($hex, 2, 2));
			$color['b'] = hexdec(substr($hex, 4, 2));
		}
		
		return $color;
	}
Source: http://snipplr.com/view/4621/convert-he ... gb-to-hex/

Is there anything wrong with it?

Re: Small banner creator

Posted: Sun May 08, 2011 1:02 am
by Dylan
This is pretty nice; the design is well and functions nicely!

Re: Small banner creator

Posted: Sun May 08, 2011 1:02 am
by Tino
ereg, that's what's wrong with it.

Use preg_replace instead.

Re: Small banner creator

Posted: Sun May 08, 2011 1:23 am
by GenSwat
I likes it nice job m8

Re: Small banner creator

Posted: Sun May 08, 2011 7:53 am
by bowersbros
EcazS wrote:
jacek wrote:Are you sure the password it right ? I don't seem to be able to log in.
Are you typing it right? O:
The password is all lower-case.
make username case insensitive by using strtolower() around the value before you check with database (also do same with registrations so its the same) capitals are very annoying to remember for usernames and emails etc and add no extra security since they're visible.

if then, when you display a username you want it to be like User1 instead of user1 as it would be seen if just echo'ed

Simply use ucwords() around the display variable. :')

Re: Small banner creator

Posted: Sun May 08, 2011 10:45 am
by jacek
Tino wrote:ereg, that's what's wrong with it.

Use preg_replace instead.
A simple str_replace would do in this case.

Other than that it looks good to me ;)

Re: Small banner creator

Posted: Sun May 08, 2011 11:03 am
by Tino
Hmm, true indeed :)

Re: Small banner creator

Posted: Sun May 08, 2011 12:16 pm
by EcazS
Good point Bowers, that never occurred to me :lol:
I ended up using preg_replace...

I now added a color wheel so you can use other colors. I also noticed if you add a "!" in the hex box it's going to be "remembered" by the form but the color will still be black and if you type a bunch of invalid characters the box will be empty. So for now, just use valid stuff :lol:

http://ecazs.net/banner/

Username: User1 (not case sensitive anymore ;) )
Password: user1

Re: Small banner creator

Posted: Sun May 08, 2011 12:37 pm
by Tino
That might be because of the !important thing in CSS. I never used it and have no idea what it is for, but apparently it could have some sort of effect on this :)

Just theorycrafting though.

Re: Small banner creator

Posted: Sun May 08, 2011 12:45 pm
by jacek
I think it makes that style apply to child elements have that style even if they specify their own. There is an IE hack that involves it too, not really sure what it does to be honest.

Re: Small banner creator

Posted: Mon May 09, 2011 10:37 pm
by EcazS
UPDATE :D
Added a live preview of background, text and text color.
Improved quality by switching to PNG instead of JPG :)
I will NOT remove images from now on, unless I find them inappropriate..(how?)
Made some changes in the design
Added more 450px bars! (check the top ones ;) )
No more login to create!

Should work fine if not, just let me know (oh and you need to have javascript enabled to get the live preview and color options...)

http://ecazs.net/banner

Issue 1 resolved
I had strlen set to < 50 not > 50 :lol:

Re: Small banner creator

Posted: Tue May 10, 2011 12:08 am
by jacek
Nice, I guess the images are so small you can store millions before you have bandwidth issues.

You can have the thin images form my banners page if you like ? You seem to be lacking in 450px wides.