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.





Replace One Color With Another In An Image?


I have the following script that replaces all red pixels on an image with a specified image tile, but I want to be able to swap the red with another hex color which I'll feed to the script. Could somebody show me how to do this? Code:




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Replace Color In Image With GD
I've been looking at php.net and here in the forums, but I cannot find the right function to replace a color in a image with GD. ie: I want to change the black color for white. Wich function should I use? I've been using imagecolortransparent() to transform the BLACK color to "transparent" but, I think is better to replace it to white.

View Replies !   View Related
Replace A Color With Another
I'm need to replace one color in an image with another (I know what the color I want to replace is, so I won't have to figure it out first). I couldn't find any PHP functions to do this directly, so I was wondering if anyone here had a clue? I'm using PNGs, by the way.

View Replies !   View Related
Select Image By Color
can any of u guys point me in the direction of a "select all images with
this color" script?

Like what they use @ istockphoto.com, where u get a pallette of colors
and click the desired color, after wich a selection of images with the
clicked color as dominant shows up.

View Replies !   View Related
GD And Changing The Color Of An Image
I'm trying to come up with a script that will change the color of a transparent png to a new color. Like #FF0000 to #0000FF. The images I'm using are solid color with a transparent background. Anyways it's not going so well. I have this script that works for palpated images but when I try to use it with an image that has alpha transparency it gets all weird on me and shows up as solid blocks of color. Code:

View Replies !   View Related
Apply Color To B/w Image
I have a grayscale image, (just three colors) and I want to use php to apply color to it, so it turns, say, blue. I have a ton of these greyscale images and a lot of colors, so I want to use php to do it when needed instead of doing them all by hand in photoshop. I have done some searching but I'm not even sure what to call this.

View Replies !   View Related
Sample Color From Image
how to sample / extract colors from an image as HEX colors?

View Replies !   View Related
Change Image Color
I've made some progress today, and now have a map that will move to the correct area based on its thumbnail image. Many a thanks to vwphillips for sharing his javascript code to accomplish the map. Now I could use some suggestions on how to accomplish the next step in my project/experiment. And that is to be able to change the color of each country on the map to the color that is assigned to it in a database.

The issue is that each country is not its own image. The map is actually composed of 100 sliced images that are 350px by 200px each. I'm not even sure its possible to segregate each country to its own image, as they consist of all different shapes.

View Replies !   View Related
Bg Color Uploading Transaprent Image
I just have a simple upload and resize image for thumbnail code...and it works okay..my problem is.. if I'm uploading a transparent *.gif image it will create a black bg color for thumnail image..and for the original image as well..so is there any solution to this.I mean I want the image and the thumbnail still remain transparent when the uploading process done...not fill in the bg with black color..like what I have just now . PHP Code:

View Replies !   View Related
Recognize Color In An Existing Image
If you have an existing jpeg/png picture file with an English sentence on it, can one determine the color of the words/font used (perhaps using GD with PHP)? I'm NOT talking about creating a new image with GD, and I don't want to translate the sentence in plain text (OCR). I just want to know how to automate recognizing a color in a certain position within a picture file.

View Replies !   View Related
Font Color In Jpeg Image (nearly) Always Orange
I am trying to run a basic script that displays an existing jpeg image
and writes some text over it. Sounds simple, but I cannot seem to be
able to colour the font correctly. In the example below it should be
black but it comes out orange. In fact, even if I change the colour to
0, 0, 255 it's orange.

I've read in the PHP documentation (the user contributed notes) that
there are issues with jpeg font colouring. But I've not seen any
details. Can anyone shed light on this for me please?

The example code below is called as a function. The $image variable is
a path to the existing image file and the $ttf variable is a path to a
TrueType font. The $text variable contains a text string.

header("Content-type: image/jpeg");
$base_image = imagecreatefromjpeg($image);
$font = $ttf;
$fontcolor = imagecolorallocate($base_image, 0, 0, 0);
imagettftext($base_image, 18, 0, 10, 100, $fontcolor, $font, $text);
imagejpeg($base_image); imagedestroy($base_image);

View Replies !   View Related
Image Create Default Background Color
I have a script that crops and image and resizes it, but that's not the problem.

If the image is smaller than the crop area, PHP just fills it in with black.

Is there a way to make PHP fill it in with white instead of black?

View Replies !   View Related
[GD]: Open Existing Image(url) & Set A Transparent Color
lets say i output an image like this:

$img = array('somedomain.com/foo.jpg');

<img src="$img[0]" alt="" />

but it has a white background and i want to strip the white background to be transparent

how do i do that and output it inline again?

View Replies !   View Related
Paint An Opaque Layer Of Color Over An Entire Image?
Is there code (if so, what is it?) to paint an opaque layer of color over an entire image?

View Replies !   View Related
Return Or Start Downloading Png File And Manipuate The Image E.g. Resizing, Color
i have this situation. i have a query string:

http://www.myquerystring.com?x=xxxxx

what this url does is it will return or start downloading a .png file.
what i wanted to do is trap this png file and manipuate the image like
resizing, color...etc. how can i do this?

View Replies !   View Related
Replace Text With An Image?
is there anyway to use file_get_contents to search for a text in a websites source code and then when it finds the text stated it displays an image?

View Replies !   View Related
Replace Existing Image
There is an XML file on the server which contains a photolink tag, storing the current location of the image. I want to enable the user (client-side) to upload a new image such that old path in XML file is replaced by the path of the new image.

View Replies !   View Related
Replace Previous Uploaded Image
Using the GD Library, how do I display an external image, on the canvas, whilst displaying the following centered text.

View Replies !   View Related
Color Background Cell Color Per Row
I am trying to create a display page for my database records, where each display-row has a different color than the previous one. I think I can do that if I where able to get the rownumber of the recordset. Than for each 'even' number I asign a color, and for each 'uneven' number a different one. Code:

View Replies !   View Related
Ereg Replace Or Preg Replace
I have HTML content that I want to do a search and replace of urls. If the content contains an <a href="" I want it to take the content and append an id to the end. For example:

<p>content here <a href="http://www.somewhere.com/">link</a></p>

would change to:

<p>content here <a href="http://www.somewhere.com/?id=100">link</a></p>

and

<p>content here <a href="http://www.somewhere.com/?var=1">link</a></p>

would change to:

<p>content here <a href="http://www.somewhere.com/?var=1&id=100">link</a></p>

Basically I just want to search for hrefs and add a tracking on the end.

View Replies !   View Related
Preg Replace - @ Sign In Replace
$string = preg_replace('/m[^a-z]*y[^a-z]*s[^a-z]*p[^a-z]*a[^a-z]*c[^a-z]*e/i', 'test', $string);

//this filters out the work myspace with any thing in between the letters I want to //modify it to also match when a user uses the @ sign in replace of the a in myspace.



View Replies !   View Related
Pixel Color
I'm using PHP4.2.2 with gd on a Linux platform and am having difficulty
in solving a little problem despite going through the definitions of the
various image functions.

If you load a true-colour image from a file using...

$image=imagecreatefrompng("file.png");

....how do you then get the red, green and blue values of a pixel at $x,
$y within that image? I'm sure it's fairly simple but I can't find this
from what I've read so far.

View Replies !   View Related
Inverting A Color
whats the best way to invert a color(hex or dec RGB).

View Replies !   View Related
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 !   View Related
Change Color
Does anyone know how I would make each row of the result a different color:
here is what I have:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<?
$connection=mysql_connect("localhost", "bla bla", "bla bla") or die
("could not connect");
mysql_select_db("yorkbia2_dbname");
$result = mysql_query("SELECT * FROM Board");
echo "<table border=0, table width=200%, bgcolor=#FFFFFF>
";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>
<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</tr>
",
$myrow[0], $myrow[1], $myrow[2], $myrow[3], $myrow[4], $myrow[5],
$myrow[6], $myrow[7], $myrow[8], $myrow[9], $myrow[10]);
}
echo "</table>
";
?>
</body>
</html>

View Replies !   View Related
How Do I Print 2>&1 In Color???
exec("chmod 0644 $fyl 2>&1");

This PHP command, as you know, will evoke an EXEC to do CHMOD on the
command line. Everything works fine, including printing the
appropriate error message piped out to STDOUT.

However, I would like the error messages in color. How do I do that
with 2>&1 within PHP or whatever?

View Replies !   View Related
Color In Windows CLI?
Does anyone know how to make PHP display colors in the CLI (Command
Line Interface)? I've tried almost everything including ANSI.SYS under
command.exe. I would like to find a way to do it under cmd.exe, I know
it will do colors under Linux in CLI using codes like ....

View Replies !   View Related
Php Color Change
I have a form that I have designed with colors. I am using php code to color
it depending upon other values.

On my pc the colors are ok. From a friends pc every field with the word
email in had a different colour. When I change the spelling of "email" to
"emial" the colours displayed on his pc revert back to the colours I have
set. We are running identical versions of windows and msie. Except mine is
the Swedish version and he has the English version.

The offending field contains a text label and an input control. If either
the text label or the name of the input control contains the word "email"
the colors are morphed. The main problem with this was that the input field
was changed to yellow text on a yellow background.

Is this because I am supplying the colors by php code or is it a problem for
all forms? What I can not fathom is why he has different colors to the ones
I have designed and why this "feature" was not displayed on my pc. We both
use std settings in MSIE.

View Replies !   View Related
PHP Color Function
I'm looking for a function which will take a text variable and outputs it with the php colours. Is there such functions?

View Replies !   View Related
Echo In A Color
I cant figure out how to echo in a color. Here is my code:

echo "<font color='#ff1200'>State / Territory Field Missing<br></font>";
the error that i receive is:

Parse error: parse error, unexpected T_IF in /home/galaxyto/public_html/phpharvest.php
I remove the font tag and the script works fine.

View Replies !   View Related
Color Echo?
I just started learning PHP and I am trying to read form data and then display it using echo. Here is what I am using echo $row["title"];

If I want to display it in let say red color how can I do that? I have trued
echo "<font color="#660000">$row["title"]</font>; but it gives error.

View Replies !   View Related
Bbcodes Color
i use the following code to replace my bbcodes:

function bb($t){
str_replace("","<img src='images/smile.gif>",$t);
return $t;
}

How do i code it so i can have colors:

View Replies !   View Related
Color Manipulation
I have an Array with colors in it RGB and want to find value in that Array that is most simular to other predefined color(RGB).

$array[1]="R255 G121 B169";
$array[2]="R212 G100 B123";
.
.
$array[n]="R123 G200 B123";

$color="R123 G124 B100";

I want to find color in $array[] that is most similar to $color. I am new to GD2 graphic functions and if u have any suggest please reply. If there is no function in GD2 that can do the job just give me idea for solving the problem.

View Replies !   View Related
SET Color Of Top Rows
how do i colour rows alternately' question that you see across the internet.

Upon displaying a sports league table i wish for the top two rows to have a certain background colour. The next two rows to be a different shade again.

This would help highlight, for instance, that the top two teams qualify direct to the finals of a coompetition, whilst the third and fourth placed teams go into a play-off match for the third qualifying slot. Code:

View Replies !   View Related
Changing Color
how can i change the color of $text3.i tried with html and css its coming but i dont know how to embed with php PHP Code:

<html>
<body>
<form method="POST" action="textbox.php">
Enter The Text:<input type="text" name="text">
<INPUT TYPE="submit" name="ok" value="ok"></form>
<?php

if(isset($_POST['ok']))
{
$text3=$_POST['text'];
$para = " how are you Mr.$text3? ";
echo $para ."<br>";
//echo str_replace("hello",$text3,$para);
}
?>

View Replies !   View Related
Color Not Displaying
The color attribute is not working. Even after giving the below in my php script not working.Tried with double quotes around green and also used alpha numeric equvalent.Not working. Code:

echo "<tr><font color=green><td><tt><b><center>Stream Name</center></b></td></font>";

View Replies !   View Related
Detecting Color
Im trying to find a way to detect the color of a certain pixel in an image with php.
Does anyone know of a way to do this? Or can maybe point me in the right direction.

View Replies !   View Related
Set Background Color
I am designing with flash and am sending variables on the end of a url to a php document which also contains a swf - I want to tell the php file what color to make the background in the html section I have:-

<body bgcolor="<?php echo $bgcol">>

I've tried moving the quote marks around but nothing seems to work - I also use php in the title and that is working fine - is it because it is inside a tag or something or do I have the wrong syntax?

View Replies !   View Related
Table Color
I wrote a inventory program and I want to color in the table output. How do I do this? Really I want it to be if os = nt color = Red, if os = 2000 color = yellow and if os = 2003 color = green. Code:

View Replies !   View Related
Text Color
How do I change the default "black" text to white in a table? Here is the script

echo "<table border=1, table width=200%, bgcolor=#6699FF>
";

Where and how do I add "text color="FFFFFFF?

View Replies !   View Related
Alternating Row Color
Here is my rss feed display script. How do I change it to have alternating row colors?Code:

<?php
$xmlfile = fopen("http://www.sonicfreelance.com/rss_sonic.php?t=0", "r");
if(!$xmlfile)die("script not functioning");
$readfile = fread($xmlfile ,40000);
$searchfile = eregi("<item>(.*)</item>", $readfile ,$arrayreg);
$filechunks = explode("<item>", $arrayreg[0]);
$count = count($filechunks);
for($i=1 ; $i<=$count-1 ;$i++)
{
ereg("<title>(.*)</title>",$filechunks[$i], $title);
ereg("<link>(.*)</link>",$filechunks[$i], $links);
echo "<li>";
echo "<a href ='$links[1]'>$title[1]</a>";
echo "</li>";
}
?>

View Replies !   View Related
Categorizing By Color
I have a list of values presented on a page, taken from a MySQL db. They list just great but it is a sea of white. What would be nice is to have each Category ID broken up by a different color. e.g. if Category ID="Internet", then its blue, if its "Business" then its green etc. Code:

View Replies !   View Related
Alternate Bg Color
PHP Code:

// Now we can display results.
$results = mysql_query("SELECT `name` , `address` , `city` , `phone` , `www` ,`subcatid` FROM `bus_list` WHERE 1 AND `category` LIKE '%Dentists%'  ORDER BY name ASC LIMIT $page, $limit");
while ($data = mysql_fetch_array($results))
{
?>
<p><?=$data["name"]?>&nbsp;<?=$data["address"]?> &nbsp;<?=$data["city"]?> &nbsp; <?=$data["phone"]?>&nbsp;<?=$data["www"]?>&nbsp; <?=$data["subcatid"]?></p>
<?
}

View Replies !   View Related
ImageCreate(); Different Color Text
I am making images, that contain a name and a job title, for each employee, so i want to do it dynamically. i have created the images but i want to know how i can make different parts of the text different colors.

View Replies !   View Related
Tables - Add Color To The Columns
I was able to get MySQL to output to an HTML Table with the following code. I was even able to add color to the columns. The following code causes the color to run vertical. Anyone have suggestions on making the color run horizontal? Sorry for the length, but you some might find this useful. Code:

View Replies !   View Related
Php Thumbs Change Color
I have a gallery which creates thumbs from pictures that are uploaded but it changes the color.

View Replies !   View Related
Color The PHP Code Into HTML
I have a website source code website. I want my code in HTML page is colored as standard color syntax. Are there anytool that can help me in this problem. For ex: My code is

<?echo "something";?>

I want the code in HTML looks colorful like:

<?echo "something";?>

Ofcourse, I can change the color manually, but I have tons of code and dont want to do it by hand.

View Replies !   View Related
Color Coding PHP In HTML
I'm really just looking for a script, but I'm having a lot of trouble finding one. Maybe I'm using the wrong "Key" "Words", I dunno. I need a script that will color code PHP and maybe even JavaScript much like these forums do. Any ideas on where I can find such a thing?

View Replies !   View Related
Change Color In Php Message
I'm having trouble to change the color of a part of a message I'm
putting together in a PHP script.
The built up of the message is as follows :

$message = "Update for Request number: " . $nbr . "
" .
"Project name: " . $prjname . "
" .
$yournamestring . $yrname . "
" .
"Your email address:" . $yremail . "
" .
"Address on site:". $osaddr . "
" .
.... ;

Now I want for instance change the color of the entry "Your email
address" and if possible also of the string represented by $yremail (or
only 1 of both), if a certain condition is true (e.g this item is
changed during an update).

I tried several things, such as
"<FONT color="red">Your email address: </FONT>" .
$yremail . "
" .

but in the email received appears litteraly all what is noted, but no
text in red.

Probably I'm using the wrong quotes or on the wrong place .... Has
anyone already did something similar ?

View Replies !   View Related
Color Mask/Filter With GD?
Has anyone had any luck with trying to create a image mask with gd. I've gone through most of the manual and the closest thing I could get was

http://www.php.net/manual/en/functi...phablending.php

I want to put a color layer over and image that makes it look like it has a blue tint or red tint etc. The GD Manual isn't really any help either.

View Replies !   View Related
Sort Color Array?
i found this message:
and i want to know more about it too.
==========================================
example:
$s_Colors="0066FF;0066CC;3366CC;0033FF;003399;003366;99CCFF;3 399FF;0099FF;66
99CC;336699;006699;66CCFF;33CCFF;00CCFF;3399CC;009 9CC;003333;99CCCC;66CCCC;3
39999;669999;006666;336666;CCFFFF;99FFFF;66FFFF;33 FFFF;00FFFF;00CCCC;99FFCC;
66FFCC;33FFCC;00FFCC;33CCCC;009999;66CC99;33CC99;0 0CC99;339966;009966;006633
;66FF99;33FF99;00FF99;33CC66;00CC66;009933;99FF99; 66FF66;33FF66;00FF66;33993
3;006600;CCFFCC;99CC99;66CC66;669966;336633;003300 ;33FF33;00FF33;00FF00;00CC
00;33CC33;00CC33;66FF00;66FF33;33FF00;33CC00;33990 0;009900;CCFF99;99FF66;66C
C00;66CC33;669933;336600;99FF00;99FF33;99CC66;99CC 00;99CC33;669900;CCFF66;CC
FF00;CCFF33;CCCC99;666633;333300;CCCC66;CCCC33;999 966;999933;999900;666600;F
FFFFF;CCCCCC;999999;666666;333333;000000;43dddd;65 432b;777665;4443cc;CCCCC3;
A906B0;9CC33F;C8C8C8;688888;777752;66E554;7655FF;5 55577;D4DCE8;99AECE;3A5A8A
;9A0030;EF3F6B;FFF543;C906CF;AA2222 ";
And true a function i add random colors in the string,
$s_Colors.= ";".strtoupper($_POST['colorvalue']);

then i make one array:
$a_Colors=array_change_key_case(split(";",$s_Colors), CASE_UPPER);
when i do
sort($a_Colors);
print_r($a_Colors);

or
asort($a_Colors);
print_r($a_Colors);

View Replies !   View Related
Search Images By Color
is there any way to make a search tool that finds images by their color using a color palette?

View Replies !   View Related
Change Link Color
i'm making a search cloud page, where the latest keywords that have been searched are listed in a table it pulls this information from my database now I want to change the color of the link depending on their serach count for example

keyword > 100 counts - make the link green
keyword <100 counts make the link blue

is there a way to do this in php? also i realize that you can use css to change link colors in a page, but I don't know how to use css to specifically change only certain links, and make those certain colors.

View Replies !   View Related

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