473,396 Members | 2,061 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,396 software developers and data experts.

Color Selector

2
The follow code enables users to select colors by clicking on an image:

Expand|Select|Wrap|Line Numbers
  1. <? php
  2. $im = imagecreatefromjpeg("ColorWheel.jpg");
  3. $x = $img1_x;
  4. $y = $img1_y;
  5. $clr1 = dechex(ImageColorAt($im, $x, $y));
  6. php ?>
  7.  
  8. <html>
  9. <form action = "pig.php">
  10. <input type="image" name="img1" height="350" width="350" src="ColorWheel.jpg"></p>
  11. </form>
  12. </html>
  13.  
Although it works, it is rather cumbersome in that the page must refresh to retrieve the selected color. Is there a way to replicate the "ImageColorAt" command using Java - perhaps initiated by a mouseover?

Any help/advice would be greatly appreciated - I have been trying to find a solution for a very long time. Thank you very much in advance
May 26 '07 #1
3 1648
pbmods
5,821 Expert 4TB
Heya, Ragnar. Welcome to TSDN!

I'm moving your post to the JavaScript forum, where you'll get more relevant exposure.
May 27 '07 #2
acoder
16,027 Expert Mod 8TB
Is there a way to replicate the "ImageColorAt" command using Java - perhaps initiated by a mouseover?
Yes, this is possible using javascript.

Save the PHP that returns the colors in a separate file. Read up on AJAX by checking out the tutorial links in the Offsite Links thread.

You will need to pass the image and the current x and y co-ordinates. For the position of the mouse, see link.
May 28 '07 #3
Ragnar
2
Yes, this is possible using javascript.

Save the PHP that returns the colors in a separate file. Read up on AJAX by checking out the tutorial links in the Offsite Links thread.

You will need to pass the image and the current x and y co-ordinates. For the position of the mouse, see link.
Thank you very much ACODER. Give me some time to study the links you gave me and I'll tell you how it works out. I really appreciate it!
Jun 2 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

25
by: Tim & Alethea Larson | last post by:
In order to mark links leaving my site, I recently added this rule to my stylesheet. A:after { content: "\2197" } The character is a northeast-pointing arrow, since that seems to be fairly...
2
by: Andrew Poulos | last post by:
If I have some HTML that looks like this: <div class="option"> <table> <tbody> <tr> <td>blah</td> <td>blah</td> </tr> </tbody>
1
by: John Rowe | last post by:
I run the web site for a University department. A few of my authors will carefully write: <h3>Title</h3> <p>Some text here.</p> <p>Second paragraph.</p> Most of us can't be bothered(!): ...
2
by: datactrl | last post by:
Hi, Can I define a css class selector depending on another class selector? Thanks a lot! Jack
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
8
by: sajid | last post by:
The CSS 2.1 Specification describes how to sort a list of selectors in order of specificity, but it doesn't provide a method to calculate the specificity of a single selector in isolation. I've...
3
by: JakDaniel | last post by:
is it possible, create a selector as alias of another selector... (maybe) in another stylesheet file? ex: html page .... <link rel="stylesheet" type="text/css" href="style1.css" /> <link...
3
by: RobG | last post by:
The link below is to a CSS selector test suite that tests 6 popular libraries: <URL: http://ajaxian.com/archives/slickspeed-css-selector-testsuite It might be of interest to some. -- Rob
3
by: Rotsey | last post by:
I do not have a configuration selector on my vs screen Is this due to the fact that I selcted VB as language when I installed vs??? How do I bring up the configuration selector I cannot see...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
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...
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.