Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Random Text & Background Colors?


Is there a way to generate colour hex strings that are guaranteed to be dark
and thus good as random-generated text colours?

something like
-------------------
srand((double)microtime()*1000000);
function tc() {
$frag = range(0,6);
$text = "#";
for ($i = 1; $i <= 6; $i++) {
$text = $text . $frag[mt_rand(0, count($frag)-1)];
}
return $text;
}
$text = tc();
--------------------
is what I have in mind.... but I really don't know how the hex codes for rgb
realte to "darkness"

And while I'm on the subject, whats the converse (for pale colours, for
backgrounds) look like?




View Complete Forum Thread with Replies

Related Forum Messages:
Changing Background Colors
i'd like my website background color to go through the whole entire color wheel. is there a way i can do this based on a 24 hour day with php?

View Replies !
Print Table With Background Colors
I've a table in wich I've this CSS:

..oddrow{background-color:#FFFFFF}
..evenrow{background-color:#CCCCCC}

The oddrows are white and the even are grey.

BUT ! when I do print the table, there is nothing !!!

View Replies !
Background Colors On Display Pages
Is it possible to display table data using a while loop, yet have each output row with a certain bg color depending on a value within that row. For instance, if I'm dislaying the incomes of various businesses, I want to show the business with a positive income with a green background, and the business with a negative income with a red background. Is this possible?

View Replies !
Random Background In PHP
Not sure if this can be done in PHP but I'm looking at giving users an option to choose a background image from a list ie when they click on a url it changes. If you click on the links to change of scene on the left hand column, you'll hopefully see what I mean.

Can this be done in PHP? I've tried googling it, searching on various forums but can't seem to find anything..

View Replies !
Random Background Image
I'm designing a site that needs to do the following: Select randomly from a series of about 5 different background images Store the selected image name in a session variable I'm pretty sure that I can setup it's selecting randomly from images and storing it in a session variable. The thing I can't figure out is how I should execute it most efficiently. Will it work to do a php file include of the php file that has the code.

View Replies !
Random Background Image + CSS
I have images stored in a server folder with metadata in Database.

The images are to be used as Background Images set in a .CSS file...

background: #fff url('../images/main_bg.jpg');

How do I display images by random in the CSS file?

Is it possible?

View Replies !
Background Text Image
How can I place text on a page like a watermark background. For
example, I may want to put FOR SALE in large red letters in the center
of a page at a 10% opacity then write text over it from the initial
point of origin. I've tried using style commands, but the results are
inconsistant.

View Replies !
Text On A Background Image
it needs to have the background of another image (bg.jpg) and then have text printed on top of it. I have tried jpgraph but it was to hard to understand then i tried this:
    <?php 
        header ("Content-type: image/png"); 
        $img_handle = ImageCreate (230, 20) or die ("Cannot Create image"); 
        $back_color = ImageColorAllocate ($img_handle, 0, 10, 10); 
        $txt_color = ImageColorAllocate ($img_handle, 233, 114, 191); 
        ImageString ($img_handle, 31, 5, 5,  "My first Program with GD", $txt_color); 
        ImagePng ($img_handle);  ?>

View Replies !
Random Text
If I have 3 lines, say:

echo "Yes";
echo "Maybe";
echo "No";

How do I make this into one variable that randomly picks 1 of the 3 echos above?

View Replies !
Code For Random Text
i want to know if theres codes for random text like i can write a bunch and php will generate 1 everytime some 1 reloads the page?

View Replies !
Random Text Script
i want to use a script that will call up random text files for insertion in a webpage, which is easy enough, but the important thing is that it needs to cycle through all of the text files in the directory first before it repeats any of them. is this possible? how would i go about modifying a regular 'random text file' script into one that will behave this way?

View Replies !
IRC Commands --- Command + Random Text
I'm making AJAX/PHP/MYSQL chat thing, and I need to add some IRC commands.

Unfortunately, I don't know how to make it ask:

IF $_POST['message']

is something like --> /kick *

that * refers to persons name. But I need to know how to make it notice which command is used and seperate the actual commad from the command tag.

Like if I write "/time 60" it would do the function i have arraged for this "/time" command. And it would use that "60" part as a variable in that function...

View Replies !
Random Element From That Text Document
Coud someone please send me a script which uses a text document which pulls out a random element from that text document (like a picture or some text),

View Replies !
Random Line From Text File
I want to grab a random line from a flat file and then echo it. I could probably do this but the alcohol prevents me from thinking.

View Replies !
Random Picture Display With Text
I want to display random picture from folder with text for each picture like caption.

View Replies !
Multiple Random Lines From Text File
I have a text file with HTML fragments, one on each line. I want to display 4 of these lines, in a random order, with no repetition. Code:

View Replies !
Modifying Contents Of Text File And Filenames With Random Data
I have multiple (about 40) text files on a web server that contain the following line of text (each file contains the exact information, except for the "randomize" part which contains random text for each file): Code:

View Replies !
Odd Even Colors
I have a display page that displays work orders. I would like everyeven work order number to have one background color for the td and the odds another color. I am doin all of this in php.

View Replies !
Calculating Colors
wondering if anyone has built or knows of a script out there that will calculate and output all of the websafe colors as hex values.

View Replies !
Alternating Td Colors
Can someone give me some easy code to alternate background colors in table cells?

View Replies !
Manipulating Colors With Php
Say I have a user submitted hex value of #CC0000 (red). Is there a way to darken it (to value #660000 for instance) on the fly?

View Replies !
Changing Colors
I have this form where you can submit a DJ line up for an event. I want the user to be able to change the font color whenever they wish, and when they hit enter, for it to skip a line. I would like the to be able to do this without them knowing how to use the <br> and <font> commands. Kind of like you see on a phpBB board or something


But is there a way to make this button, and when the click it, it keeps the text that they have already entered into the textarea adds a [ i ] or whater and then when they click the button again, it inserts the [/ i ] without altering the text they already typed. it would be much like the buttons you use to do your PHP and color changes in this forum, but without the pop-up window to enter your code into.

View Replies !
Colors In Array
How can I make the following array alternate row colors. I know.. I know There are hundreds of examples of this out there. But I haven't found any that also incorporate the ability to sort in the following code. Code:

View Replies !
Highlight Colors
I just tweaked the background color in php.ini associated with syntax hightlighting. after stoping and restaring apache and testing my script, the background color is still white after rebooting and testing my script, the background color is still white after checking with php_info(); I see that the color is indeed set but the BG of my code is ALWAYS white still.

View Replies !
Colors Of The Thumbnail Seem To Be Off
I have a simple gallery that creates thumbnails from an image. Since my hosting provider upgraded it's version of GD, the colors of the thumbnail seem to be off:

http://www.vozz.ca/gallery/gallery2.php

like it's only displaying 256 colors or something? I had this simple script developed for me so I have no idea what functions I would need to place in my code, hopefully it's something simple.

View Replies !
Alternating Colors
I have a couple of problems with this example one is the variables dont work they just show as the variable name instead of the variables contents like this $Location grrrrrrrrr the other is no alternate colors.........one other person had the same problem with this example. Code:

View Replies !
CSS Alternating Row Colors
I have a query and a do while loop. I am trying to alternate row colors and think I can do it if I can pull in a number with each result returned, but am not sure what direction to head with it. Code:

View Replies !
Display Alternate Colors For Each Row
I wrote a code to display some values taken from text file in the webpage. I am using a function to display alternate colors for each row. I am getting breaks at the end of each column which I should not get. Code:

View Replies !
GD Choosing What Colors To Display
How can i use the GD Library to only show the White (or the hex value of
white) pixels of a image?

Imagine i have a 8 color picture in PNG format.

This is to use on a color puzzle that im trying to build...

1 - The user sees a completely BLACK image with the original size of
the picture

2 - the user selects GREEN (from a color palete)

3 - the image updates and shows all BLACK/GREEN pixels (using
something like "ShowImage.php?c=BG" or anything else)

4 - the user selects RED (from a color palete)

5 - the image updates and shows all BLACK/GREEN/RED pixels (using
something like "ShowImage.php?c=BGR" or anything else)

and so on...

Is this possible using the GD Library?

I can read the file from PNG and show it (using the gd library), i can even
change the pallete of the image based on another file's pallete, but i
wanted to dynamicaly change which colors to show on screen, based on user
input.

View Replies !
Imagecopy Save Colors
is there a way to copy two images using gd and save the colors? I've been able to get the two images copied but the second image color changes based on the first ones color. I want to preserve both colors independently of each other.

View Replies !
Alternating Colors In While Loop
I hope I'm not fixing to embarrass myself by asking this, because I have a feeling it is really simple, but has just eluded my brain waves. I have a table with several rows which is populated by a database in a while loop. I don't know how many rows the query will return as it is different everytime. I would simply like to alternate the background color of the table for each row. I have tried this but keep running in to some problem.

View Replies !
Returning A List Of Colors
Is there some PHP function that will look at all the pixels in an image and return a list or table of all the colors used in that image? Alternatively, is there a function that will return the color of just one pixel identified by row and column? If so I could write my own script to check all the values. 

View Replies !
Alternating Row Colors In This Script...
I would like to alternate my row colors in this script and was wondering what would be the best way to accomplish that with how my script is formatted. Code:

View Replies !
Alternating Colors On Rows
I am making some final touches to thiis block I am working on and I am trying to get it where the rows alternate colors. For some reason though it only makes one big row and one color. Any ideas? Code:

View Replies !
Changing Image Colors
I have an image, which is a yellow circle. I want this yellow circle to change color by having 3 sliders (RGB) on a website and a button to process it. Is this at all possible and could someone point me in the right direction or a script that does this?

View Replies !
Image's Dominant Colors
I've got a predefined palette of 40-50 colors and a bunch of images. I need to get 3-4 dominant colors for each of them (exact match is not necessary - closest palette color is enough). I know there is no use checking full-sized image - 100x100px thumbnail is enough The only way I could think of is to make a histogram out of image's colors cast on palette, but since the palette is not spread evenly over sRGB color space you can't just reduce number of bits per color.


The simplest and most accurate way to cast it would be to treat each pixel's RGB values as coordinates in 3D space and find the closest point in palette, but for 40 palette colors and 100x100px image that would mean 40 x 100 x 100 = 400 000 times sqrt((x1-x2)^+(y1-y2)^2+(z1-z2)^2) + as many value comparisons.

View Replies !
How Can I Alternate Colors On A Foreach?
foreach ($items as $item) {
   $link = $item['link'];
   $title = $item['title'];

   echo "<tr><td><a href="$link" target='_blank'>$title</a></td></tr>
";
}

Combined with the rest of the code outputs this: Code:

View Replies !
Gd Library Bug? Image Lost Colors
is it a php bug or i do smth wrong?

From site

I`m taking images (those thumbs) and its name at right.

Then i generate with those elements png image

I make big ligh yellow rectangle with smaller rectangle: once grey, once
white. At those rectangles i put names (with ImageTTFText) and images
(imagecreatefromjpeg).

And finall image look... ugly. Look at this, most colors are lost

http://www.linux.webd.pl/allegro/

I have to admit that if i do not attach thumb images, colors are good.

Can i fix something or i it is libgd bug?

View Replies !
Alternating Row Colors With MySQL Results
Is there any way i could make a image for the alternating row colors instead of a strait bold color, for instance:

$color1 = "#CCFFCC";
$color2 = "#BFD8BC";

Would there be anyway to link an image in there? I have tried it this way:

$color1 = "<img src='..style1.jpg'>";
$color2 = "<img src='..style2.jpg'>";

View Replies !
Detecting HEX Codes For Similar Colors
Is there any way by which i can detect the HEX codes for similar colors if i input a color code ?

What i mean if if i enter the color code for an Orange, the output should be another shade of Orange.

This can be seen in action at http://feeds.feedburner.com/~fc/GotChance?bg=FF9900&fg=000000&anim=0

If you change the "bg" parameter, the background color changes to that color and a similar shade is applied to the smaller background. How do i do something like that ? Also, how to i find HEX codes for complement colors ?

View Replies !
Get Alternating Row Colors Into My Database Table
i'm trying to get Alternating Row Colors into my database table and i get this error
Parse error: syntax error, unexpected T_VARIABLE in index_altrow.php on line 52

line 52 is: $table .= "<tr><td class="$class">$arr_value</td></tr>";

here is the code i am using to make the rows alter in color Code:

View Replies !
Alternating Row Colors On Query Generated Table?
Is there some way to make a table have alternating colors for rows when
you're generating the table data with a WHILE statement?
You know, row 1 has a gray BG, row 2 is white, row 3 is gray, 4 is white,
etc, for as long as there's data.
Here's what I'm using right now:

$query_RSwho = "SELECT * FROM tbl_indv ORDER BY name ASC";
$RSwho = @mysql_query($query_RSwho, $connection) or die("Couldn't query: "
.. mysql_error());
while ($row_RSwho = mysql_fetch_array($RSwho)) {
if ($row_RSwho['name'] != "X") {
$names .= "<tr align=left><td
width=120>".$row_RSwho['name']."</td><td
align=left>&nbsp;--&nbsp;".$row_RSwho ['email']."</td></tr>";
}
}

So, in that WHILE section, is there a way to alternate bgcolor table cell
tags?

View Replies !
Using GD Library To Create An Image Overlay For Colors?
I'm creating a script that will generate a user avatar based on some inputted variables, like armor type and color. my biggest hurdle right now is trying to figure out how to add color to a section of an image using GD.

Say someone wants their helmet to be green (now, only one part of the helment should be green, the rest should stay grey). I thought about making a mask in photoshop of the area that is to turn color, make that white, and the rest of the image transparent. So you now have 2 images. The greyscale helmet, and the mask that fits OVER the helmet image which you intend to color and blend. Still with me? If so...

I've done that. I've got my helmet image, and the mask which covers the areas I want to change color with solid white. Now, my issue is, if I add color to my mask image, and then overlay it, the transparency of the mask is GONE. The whole image becomes green! Only the white is supposed to turn green!

View Replies !
The Function To Switch Values Ie For Alternating Between 2 Colors In Table Display
What is the php function called which allows you to alternate between
two values? I've completely forgotten it and my searches in php.net
have not been fruitful!

View Replies !
Pagination & Sort By Stationary Column Header & Alternate Row Colors
Is it possible to have all these features in one mysql data output? I have the sort by column header and alternate row colors....but NO sationary column headers and no pagination.

I've tried to combine each of these features, but I can't get it to work together! Can someone provide an exmple of how this code will look?

View Replies !
All Probs Solved: Pagination/Clickable Ordering/Alternating Row Colors
Pagination/Clickable Header Ordering/Alternating Table Row Color Output. Code:

View Replies !
In Background
Here's my situation. I'm creating a website (basically a store) and in the admin section users will want to download zip files of images or products added in the last 7 days, last 2 weeks and the last month.

I have scripted a cron to run every 24 hours to zip all the images and this process takes over 1 minute (there's over 6,000 images!!) and the size of this is 250MB. This has now taken me to my quota on my webspace of 500MB (including all the individual images)

I have decided the only way to do this is dynamically create the zip when the user requests it. As PHP times out after 30 seconds it needs to do it's stuff in the background and display a message saying something like' We'll email you with the zip file in 5 minutes or so'.

View Replies !
Run In The Background?
I have a script on my website that takes a long time to run, and it's slowing down my pages. Theres nothing I can do about the wait time on the file.

Is there a way to use include or fopen or anything along those lines, to have it execute my file in the background; without having the file that's executing it waiting for it to finish its thing? Or to have the expected output redirected to another file (as mentioned in http://ca3.php.net/manual/en/function.exec.php)?

View Replies !
Running Background Job...
Is it possible to get a php3 script to check what day it is, and then do some stuff, If it’s let’s say Monday?
This without you doing anything. Like a background - or cronjob…
I guess you would use perl or something to do this, but that is not an option I have.

View Replies !
Background Processing
What is the technique you use for background processing? Like when user submit a task, the user could then wait for the result by email or through a result page.

I'm wondering how would they do that?

View Replies !
Background Color
I am totally baffled by what is happening in my code. I have a section
of code (shown below with two comment lines inserted). They are
essentially identical text boxes (names and variables different). Yet,
the first comes up with a white background and the second comes up with
a yellow/gold background....

View Replies !
Run Process In Background
I want to run process from my php script in background.
I try different functions from functions list but all of them whaiting for
process ending. How can I run `wget -b ...` and finish my script, but wget must still working? I use PHP5, Linux, Apache2.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved