vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Programming Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=188)
-   -   Gradients made easy! (https://vborg.vbsupport.ru/showthread.php?t=89526)

Natch 07-21-2004 10:00 PM

Gradients made easy!
 
1 Attachment(s)
OK - now we all know how to make gradients using our weapon-of-choice image editor, but surely it could be easier than that ?

Well from the guy who brought you PNG24 transparent images in IE without that grey box rendering effect comes the next big thing - gradients on the fly! Dynamic images, that will be cached by your browser and can be written to the server if required (not yet implemented).

All you need is a text editor, and an array of Hex colour codes to match your forum, and you are ready to rock and roll.

Upload the following new files:

forumroot/images/gradients/gradient.php
forumroot/includes/class.gradient_image.php

The forumroot/images/gradients/gradient.php file has instructions for usage in the comments - the class I have used is from phpclasses.org - please read the licensing requirements if you plan on using this in a for-profit situation.

Demo: Demonstration of three different styles of gradient, with four different colours each - take a look @ the html source for how I am doing each image...

Any questions?

Jolten 07-24-2004 06:57 AM

Thing is.. your two php files total 12 k... my gradient image can be 1/2 that or less. I'll stick with an image. it get's cached and only needs to be downloaded once as opposed to a repeated download of 12k for the php files every time a gradient is called.

Natch 07-24-2004 10:00 AM

Quote:

Originally Posted by Natch
Dynamic images, that will be cached by your browser

Also for those that DON'T have access to a gfx proggie like Photoshop, a tool like this might be useful, no?

Thanks for your considered answer tho'

EDIT// a futher note: (for those that are not put off by ScottW's ill-considered remarks):

The only thing downloaded by the client machine is the generated gradient image - the processing of the scripts (unless PHP has changed it's behaviour) is done server-side...

So there will be no difference between gradient images created using this script and any created by a graphics proggie... except maybe you will find the images created by this script to be MUCH SMALLER! example any of the gradients on my demo page above will be between around 150-200 bytes in size! and are cached by the browser ...

I really thought that this would be useful - I have found it useful - and if you are really worried about the size of the PHP scripts you can reduce them in size by removing the comments...

:shrugs: ah well - back to the basement ...

Reeve of shinra 08-05-2004 04:20 PM

This is cool to have. I can think of things this would be usual for.

KW802 09-01-2004 01:53 PM

Anybody have any thoughts on how to make the height dynamic based upon the height of a table row that it may be used in? :D

What I'm thinking is that for a table row that, based upon the contents of it, may be 75px but others with just small content may be 50px high so it'd be pretty cool to have the height of the gradient dynamically be set based upon the actual height of the row.

Natch 11-11-2004 04:27 AM

Unfortunately, you cannot pass javascript DOM values to a PHP script, as the PHP is parsed server-side, and the javascript DOM parsing is done client-side...

I've thought about things like this before, but it's really not possible...

What you would have to do is change the structure of the script to pas in height variables externally, rather then having them hard-coded....

kbothe 12-20-2004 04:39 AM

Thanks Natch, great work man!

HPIA 10-15-2006 12:33 AM

The link doesn't seem to work...

deejayh 11-10-2006 08:13 PM

HPIA,

If you look at the date = 22. Jul 2004 04:56
It is some time ago!!!:surprised:

Josh1 11-19-2006 10:53 PM

The link works perfectly lol.


All times are GMT. The time now is 09:13 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01160 seconds
  • Memory Usage 1,735KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete