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.





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 Complete Forum Thread with Replies

Related Forum Messages:
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 !
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 !
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 !
Setting The Background Color Of A PNG
I'm attempting to set the background color of an image, but it doesn't seem to be working. The PNG image has a transparent background to begin with, but whenever I print the image out, the background is always white. Code:

View Replies !
Using Sessions To Change Background Color
I am trying to use session to store the background color throughout each page by session variables. I think the problem comes from the structure of my site. each page is accessed by ?topic=home or ?topic=tutorials It is setup as: example not actual code:

View Replies !
Table Background Color Based On Value
I'm trying to make this happen on query from my database .

$h1 = 4;
$h2 = 5;

if ($h1 == 4){$color="green";}
if ($h2 == 5){$color="yellow";}

print "<table><tr>";
print "<td bgcolor=$color>$h1</td>";
print "<td bgcolor=$color>$h2</td>";
print "</tr></table>";

View Replies !
Imagerotate(), Producing A Black Background Color
I am having this Image, the background of the image is transparent

But on rotation using imagerotate(), it is producing a black background color.

This background color is coming on using any function on the original image
ie, like imagecopy() etc . I have used imagecolortransparent() to suppress the
color, but still the problem is coming.

View Replies !
Change Background Color In Table From 2nd Row Onwards?
i am displaying data in a html table with five rows of five columns each, the first row is a title row with blue background, and the 2nd row onwards is the data rows with a radio button.

When a user click first row, nothing should happend, but when the user clicks the radio button or any column of the row, I wish to select the radio value (clicked) and set the background color to silver for the entire row of five columns.

Here is my javascript code which is working fine, except it removed the first row style background color, which I don't wish to remove. Code:

View Replies !
Does PHP Support Ancillary Chunks In PNG Images (background Color)
I want to create 24 bit PNG image files (red, green, blue, alpha) with PHP -- that's easy enough.

However, I would like to include a background color value as well, as a default. The Wikipedia article for PNG images states that PNG includes "ancillary" chunks, one of which is the background value: Code:

View Replies !
ImageCopyResampled - How To Avoid Default Black Background?
I would like to know how to avoid the default black background color in ImageCopyResampled if origin and destination do not fit.

ImageCopyResampled puts always a black background and if I try to fill it with another color and with ImageFill function, ... I get problems: Some images with a deep dark colors predominance or even with a deep light color predominance too, are filled with my color, as you know, applied with ImageFill. Code:

View Replies !
Table Background Color Based On Results From MySQL Table
I am trying to get the "Did User Agree" field on a database query to be colored Green for "Agreed" Red for "Disagreed" and Blue for "Agreed (2nd Time)" .. I have my PHP setup to do the query just fine as of right now with alternating column colors, just can't seem to get the colors to work as I am hoping for.  Can anyone help me get the Agreed? table's background color to the colors above? Code:

View Replies !
GD Create A Square To Show The Color
I have a form that allows the user to configure some properties of an item. One of the properties is the color scheme. At the end I wanted to present them with a summary of their configuration and wanted to show their selected colors as small colored squares. I am using php to create the resulting summary page and was wondering if you could tell me how to use GD to create a, say 20x20, square that shows the color.

The reason I want to use GD to create a square "image" is because I want the summary page to be printable. If I use <table> with the selected color as background, it shows on the screen but not when you print the page, since by default background printing is disabled on browsers.

View Replies !
Create Table With Default Values
I have the following code that creates a table structure. How do I give Age a default value of 0

mysql_select_db("DB", $connection);
$sql = "CREATE TABLE Person
(
Name text,
Age text,
Sex text
)";

View Replies !
Background Image
i created a calendar in php. i have this calendar displayed on another php page (index.php).

i added a background image to the calendar. it displays fine on the calendar alone but it won't display as a background image when i display it on index.php.

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 !
Premade Gif That Set As The Background Of An Image
I have a few questions about GD in PHP. If I have a premade gif that I want to set as the background of an image Im making on the fly how would I do that?

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 !
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 !
Background Image Load Problem
I have a table with a large background image:

<table style='background-image: url(images/eagle_country_large.jpg); ..'>

The problem is that everything on the page loads except there is a big delay with the loading of the image.

It's not like a regular image loading. Somehow it looks like the page is finished, then a delay, and then the background picture appears. It's even worse on a dialup connection. Code:

View Replies !
Question About Adding A Background Image
I have searched and dug and I have looked at probly every thread on hear and I have still not been able to figure out how to put up a simple background image I have tried a couple things from different threads but when I enter in the code I either get light blue background, no page at all, or the same as what I started with.

Here is what I am adding (with many variations)

<body style="background: #CCFFFF url('../../images/adrian18.jpg');">'

It works fine in my editor (dreamweaverMX) but when I upload it I get nothing.

Please treat me like I am Stupid, the reason is because I don't know for sure If I have been editing the right file.

the file I have been editing is index.tpl under my /templates/ folder, because it sets my layout, I do also have a index.php in my root folder.

View Replies !
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 !
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 !
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 !
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 !
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 Replies !
Sample Color From Image
how to sample / extract colors from an image as HEX colors?

View Replies !
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 !
Upload Image Default Image
I have this code for uploading images and would like to change it so that if there is no image uploaded it will place an url into the database (mysql) as the default image. Code:

View Replies !
Pull In An Image From File Which Has A White Background
trying to pull in an image from file which has a white background make the white transparent and copy it onto a new image with a black background, the script below below works except for making the background transparent, anyone got any ideas? Code:

View Replies !
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 !
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 !
Default Image
How can I write a function in such a way that it would look for a specific image to load. If that image exists on the server it will load it, if not it will load a default image.

View Replies !
Remove A Black Background From An Image To Make It Transparent Using GD
is it possible to remove a black background from an image to make it transparent using GD. for example. can i pass the radius of the moon to GD (as it is on the image) and have it slice the moon out so to speak leaving it on a transparent background.

View Replies !
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 !
[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 !
Display A Default Image?
Is there an "if" statement I can use to check if an image exists in a certain directory, and if it does display it, but if it doesn't exist then display another image in a different directory? I've written simple "if" statements for text display, but nothing like this. Is this possible?

It might help to tell the scenario. I am putting together templates for teacher web sites. If they wish, they can upload their own logo into their upload directory to display at the top of the page, but if they choose not to upload their own logo I want the default (district) logo to appear there. The default logo is located in another directory on the same server.

View Replies !
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 !
Setting An Image Field As A Default?
In my application I have 6 image fields. If a user uploads an image they must upload an image 1 which is the main image. So I dont want them to be able to jump to the 2nd or 3rd fields and upload their file there. I am just not sure how to go about defaulting them to upload image 1 first?

View Replies !
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 !
Database Stores Default Number Everytime, But I Havent Set A Default Number??
Im having some problems with my database. Everytime i store a number which is longer than 10 numbers the script or database puts this number into the database: 2147483647. Its does this everytime no mather how i write the numbers and nomather how long the number is, it just needs to be over 10.

I have set any default value in the database and to be sure i havent i tried deleting the table, but same thing happends again???

View Replies !
How To Create An Image On The Fly?
I've created an image with this code

Header("Content-Type: image/png");
$image = ImageCreate($W,$H);
$white = ImageColorAllocate($image,255,255,255);
$black = ImageColorAllocate($image,0,0,0);
ImageLine($image,0,0,$W,$H,$black);
ImagePng($image);
ImageDestroy($image);

but now I wish to add a line

echo "Hello";

before the image code, then I only get garbage, the header command is
probably invalid now. So how do I create the image without having to save
the image to a file?

View Replies !
Image Create?
i need to create a php image like pie chart and i can create that but when i create it dynamicaly and the chart data will come from database then i cant understad that how will i do that. is there anybody who can help me how will i use database to make a pie chart.

View Replies !
Create A Image With Php
How do I create a image with php using html for an example i want to make

<?
$message = "Welcome";
echo "<table width="435" height="75" border="2" cellpadding="0" cellspacing="0" bgcolor="#ff3300" bordercolor="#FF6600" style="border-style:Dashed;"><tr><td><center><h1><b> $message </b></h1></center></td></tr></table>";
?>
into an image
i have this code i like it but it only dose text
<?php
header ("Content-type: image/png");
function imageCreateTransparent($x, $y) {
$imageOut = imagecreate($x, $y);
$colourBlack = imagecolorallocate($imageOut, 0, 0, 0);
imagecolortransparent($imageOut, $colourBlack);
return $imageOut;
..................

View Replies !
How Do I Name An Image When I Create It?
how to change the name of the file. I'm creating several images of different sizes. I need to give them all different names. How do I control the name? Code:

View Replies !
Image Create
We currently are using the code pasted below to fill in documents and then they are uploaded to our FTP server.

We have another online form that our dealers process credit applications for customers. We want to be able to integrate this and have the information fill in and create the image.

However, we do not want it to go to the FTP server. How would you need to set it up so that once they submit the application and the image is created they can click on a link and be able to access the image and print it.

View Replies !
Create And Image
I have this script and it works fine locally but as soon as i upload it breaks. What happen once it's online is the image (800x600) gets created but not the text. however locally the text gets created.

<?php
$pic=ImageCreate(800,600);
$colBG=ImageColorAllocate($pic,255,255,255);
$col1=ImageColorAllocate($pic,0,0,0);
$nomalFont = "arialbd.ttf";
imagettftext($pic, 29, 0, 100, 200, $col1, $nomalFont ,"some text");
ImageJPEG($pic,"pic.jpg",120);
ImageDestroy($pic);
?>

View Replies !
Create An Image
using php is it possible to take a <div> section and convert it into an image.. for example if someone was going to customize a business card... and they could chooose backgrounds and text (which would format using javascript or php) you would format a div tag to look like their card, then convert that tag to an image, and store it.

View Replies !
Create One Image From Two Diffrent Gif:s!
does anyone know how I create one image from two diffrent gif:s ? And is there someone who knows if you can create one image from one gif file and one png file ??? I had some problems with the header there.

View Replies !
Create And Save An Image
As a test to understand how to create and save a file on my server i
created the next code:
---

<html>
<head>
</head>
<body>

<?php

$thumb = imagecreatetruecolor(100, 100);
Imagejpeg($pic,"pic.jpg");
ImageDestroy($pic);

?>

<img src="pic.jpg">

</body>
</html>

---

View Replies !
Create Image From Bytes
I have a web service returning me an Array of Bytes in the form of a Jpg. I am trying to us the GD lib to create the image.

Here is my code ($imageBytes is the array of Bytes)

//Create the image from Bytes to JPEG.
$img = imagecreatefromstring($imageBytes);
header('Content-Type: image/JPEG');
header("Content-Length: " .strlen($imageBytes));
imagejpeg($img);

But the image is not displaying. Should I use GD, or should I use something else. Any ideas what I am doing wrong.

View Replies !
Create An Image With Imagettftext
I'm trying to create an image using imagettftext - at the moment I am just trying to get some basic image to work and then I plan to do stuff with it. Code:

View Replies !

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