Ok all, I have a question regarding the gd library in php. First, let me say that there is really no reason why I am doing this the way that I am. I was a little bored with doing homework and thought to myself, hey I wonder if I can put a background images into parts of a webpage using css pointing to php files. So I set out to answer the question that was burning away at me... :)
Anyways, here is the code I am using to create the background for the top of a web page, 120px high. The final png is made up of smaller 5px high pngs that have a slight color change, giving the final effect of a little fade, if you will.... -
header ("Content-type: image/png");
-
-
$bg = imagecreatetruecolor(100, 120);
-
$back = imagepng($bg, "bg.png");
-
$back = imagecreatefrompng("bg.png");
-
-
$color = 232;
-
$x = 0;
-
-
while ($x < 120) {
-
$im = imagecreatetruecolor(100, 5);
-
$fill = imagecolorallocate($im, 0, 0, $color);
-
imagefill($im, 0, 0, $fill);
-
imagepng($im, "add.png");
-
$one = imagecreatefrompng("add.png");
-
imagecopy($back, $one, 0, $x, 0, 0, 100, 10);
-
imagepng($back, "bg.png");
-
$x = $x + 5;
-
$color = $color + 1;
-
imagedestroy($im);
-
imagedestroy($one);
-
}
-
imagepng($back);
-
imagedestroy($back);
-
imagedestroy($bg);
-
?>
-
-
Now the problem I run into intermittently is that every so often when the page loads, it doesn't render all the lines into the final png correctly. The color gets messed up in the smaller image and then the messed up smaller image gets added into the final image having the wrong color.
Any thoughts on why this might be or what is causing this?
2 1144 pbmods 5,821
Recognized Expert Expert
Heya, Lumpy.
Do you have a screenshot of what it looks like vs. what it's supposed to look like?
Heya, Lumpy.
Do you have a screenshot of what it looks like vs. what it's supposed to look like?
So, I got the problem solved. I was in the process of making some screen shots that I would be able to post, so you would be able to see what I was doing and what I meant by the problem I was having. When I noticed a little pattern. When the lines showed up in the overall png, It matched up with another part of the site, in which I am also using the same process to make the background. Noticing this I examined the code from both files again, and realized that I was using the same file name for the temp png, "add.png", opps. What was happening was it was grabbing the wrong "add.png" and inserting it into the whole png. Long story short, I changed the temp file name and now everything works perfectly.
Thank You for your inspiration!!!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: David MacQuigg |
last post by:
I'm not getting any feedback on the most important benefit in my
proposed "Ideas for Python 3" thread - the unification of methods and
functions. Perhaps it was buried among too many other less important
changes, so in this thread I would like to focus on that issue alone.
I have edited the Proposed Syntax example below to take out the
changes unecessary to this discussion. I left in the change of
"instance variable" syntax (...
|
by: Will Pittenger |
last post by:
Does C# inline functions? I do not see a inline keyword. Is there an
implicit inline? Can the compiler select functions for auto-inlining? I am
more used to C++ where all these things are possible.
----------
Will Pittenger
E-Mail: mailto:will.pittenger@verizon.net
All mail filtered by Qurb (www.qurb.com)
|
by: Tomomichi Amano |
last post by:
Hello
How can I delete (clear) lines that were made useing Graphics.DrawLine() ?
Thanks in advance! Have a nice day!
|
by: Brian |
last post by:
Hello all..
Am working on an Air Hockey game... have an table loaded into a
picture box. The borders of the table are slightly slanted. Am using
hit testing lines with GDI+ to manipulate the puck moving around. I
want the puck is bounce when it hits a border (specified by the
hitlines).
Retreieved some info on hit testing lines from Bob Powell's GDI+ FAQ
(very useful!) but i'm fairly new at the idea of hit testing and am
|
by: davetelling |
last post by:
I am not a programmer, I'm an engineer trying to make an interface to a
product I'm designing. I have used C# to make a form that interrogates the
unit via the serial port and receives the data. I want to be able to draw
lines in a picturebox based upon certain data points I have received. I
dragged a picturebox from the toolbar onto my form, but after having gone
through the help files, looking online and trying a variety of things, I...
| |
by: Craig Lucas |
last post by:
Im kind of new to vb.net drawing routines. Im reading a collection of 2d
points from a
proprietary file. These points are simply for drawing lines, I can draw the
lines fine using Graphics.DrawLine, but I need to scale all the lines to fit
a rectangle of a given width and height.
What is the best method to do something like this? Its also important that
the drawing retain proportion within the given rectangle.
Thanks
|
by: Francine.Neary |
last post by:
I'm finding it really hard to keep some of these things straight...
For example, fputs is to puts as fprintf is to printf, except that
fputs has the file handle at the end and fprintf at the beginning!
Very illogical! And hard to remember.
Now this can quite easily be corrected by macros, for example:
#include <stdio.h>
#define fputs(X,Y) fputs(Y,X)
|
by: lifeisgreat20009 |
last post by:
I want to make a "GRAPHICS PROGRAM" in C language that shows sorting of lines. Something like this:-
------------
-------------------
------
------------------------------------
after sorting the lines should appear as follows on the screen :-
|
by: lifeisgreat20009 |
last post by:
I want to make a "GRAPHICS PROGRAM" in C language that shows sorting of lines. Something like this:-
------------
-------------------
------
------------------------------------
after sorting the lines should appear as follows on the screen :-
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |