473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

PHP4 and graphics/transparency

Hi,
I'm pretty new to PHP but I learnt how to build button-like graphics from
graphic fragments (buttons adjusting themselves automatically on text
size).
All the fragments (left, right and middle parts of the button) I have are
..png or .jpg files since PHP doesn't support .gif any longer. But here's my
problem. There's an area within each graphic having to be transparent when
it is displayed. For example, the buttons are slightly rounded, and the
reminder of the rectangular area should get the colour of the current
background. I seem I can't accomplish it without help from an expert.

Second question in this regard: How can I pass a HTML-like colour value
(i.e. "0xA030BF" or "#A030BF") to the function ImageTTFText()? Docs say
that I have to use ImageColorAllocate() for each one colour in the graphic.
But it should be easier to pass a text colour along with the text itself to
the button creation function.

Thanks for all your help - any answer is greatly appreciated!

Michael
Jul 17 '05 #1
3 1537
Michael Kochendoerfer wrote:
All the fragments (left, right and middle parts of the button) I have are
.png or .jpg files since PHP doesn't support .gif any longer. But here's my
problem. There's an area within each graphic having to be transparent when
it is displayed. For example, the buttons are slightly rounded, and the
reminder of the rectangular area should get the colour of the current
background. I seem I can't accomplish it without help from an expert.


I haven't dealt with this stuff yet, but I have done some reading a
while back. Take a look at this function:
http://www.php.net/manual/en/functio...ransparent.php

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
Jul 17 '05 #2
Justin Koivisto <sp**@koivi.com> wrote in
news:2T*****************@news7.onvoy.net:
Michael Kochendoerfer wrote:
All the fragments (left, right and middle parts of the button) I have
are .png or .jpg files since PHP doesn't support .gif any longer. But
here's my problem. There's an area within each graphic having to be
transparent when it is displayed. For example, the buttons are
slightly rounded, and the reminder of the rectangular area should get
the colour of the current background. I seem I can't accomplish it
without help from an expert.


I haven't dealt with this stuff yet, but I have done some reading a
while back. Take a look at this function:
http://www.php.net/manual/en/functio...ransparent.php


Justin,

thanks very much - there are several helpful hints. I have to normalize the
color palette of my graphics first :)

Do you have also an idea to my second question?

Thx,
Michael

Jul 17 '05 #3
On 18 Jun 2004 13:40:27 GMT, Michael Kochendoerfer <mk@isp.hem.de> wrote:
Second question in this regard: How can I pass a HTML-like colour value
(i.e. "0xA030BF" or "#A030BF") to the function ImageTTFText()? Docs say
that I have to use ImageColorAllocate() for each one colour in the graphic.
But it should be easier to pass a text colour along with the text itself to
the button creation function.


substr and hexdec would cover splitting the hex string into RGB components.
You could then use imagecolorexact to get a palette entry.
If it returns -1, then actually allocate a new one with imagecolorallocate.

Or have an array somewhere acting as a cache for the last couple of steps.
Then just wrap that in a function.

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: news.microsoft.com | last post by:
Hello group, My goal is to attach an image over another image. Top image should be transparent so the back image is visible through the top one. Bellow is a test code in VB.NET. You need to...
3
by: Peter Oliphant | last post by:
I'm importing a jpeg via: Bitmap* image = new Bitmap( filename ) ; Then, using the Drawing::Graphics object, I execute DrawImage( image, x, y ). My problem is that the original image was...
2
by: mookid8000 | last post by:
Hi group! I want to make a program with options similar to those in Microsoft Publisher - i.e. the ability to create different types of rectangle objects in which pictures/text/whatever may be...
2
by: Lloyd Dupont | last post by:
In my .NET application I have some text rendered through GDI. It draws and print nicely. Now I would like to implement image export. So I create a new System.Drawing.Bitmap(width, height) then...
6
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument...
2
by: Stefan Huber | last post by:
Hi I've got a really strange problem, and can't find out why it's not working as intended. in order to use php4 and 5 together on a webserver and the requirement for running as different...
12
by: Drazen Gemic | last post by:
How long will PHP4 be supported ? When is PHP4 end of life scheduled ? DG
1
by: runner7 | last post by:
Can anyone tell me how to create semi-transparent graphics or table cell backgrounds for the web that allow the body background picture to show through? I know how to do this with 100%...
2
by: rory.groves | last post by:
C#, NET 2.0: I am using CopyFromScreen to copy a background user control to a foreground usercontrol to create the appearance of transparency. It works perfectly 95% of the time. However it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.