|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
SitePoint Member
Join Date: Sep 2006
Posts: 8
|
Problems with GD?
Hi!
Im having a problem with some code used to let visitors take a snapshot with their webcam and post it to a imagegallery. This uses Flash's Camera API and flash.display.BitmapData Class with server side PHP to take snapshots from a webcam and output them as PNG files. The problem is that some visitors have dark settings on their camera, and in the dark places in the image, the color becomes purple (so it looks like a negative of the picture). Do you see anything in the code beneath, that could cause this? Is there any simple solution to try ImagMagic instead of GD? (It is installed on my webserver). If not, is it possible to let the visitor see the image (like he does now), and put up a button labeled "Save", and let the user save the image ONLY if he pushes the "Save" button? Here is the code: PHP Code:
|
|
|
|
|
|
#2 |
|
It's been real...
![]() ![]() ![]() ![]() Join Date: Dec 2004
Location: Yorkshire, England
Posts: 537
|
Hi Vidar!
I'm not too surprised that no one has taken this on, GD stuff is damned awkward at the best of times. Assuming that you understand all of the above and you haven't just hacked this together from other sources, the best thing for you to do is to break this whole thing down into small segments and work through it one stage at a time. That's what I do. That way, you'll be able to isolate the source of the problem and then figure your solution from there. Hope that helps? |
|
|
|
|
|
#3 |
|
SitePoint Member
Join Date: Sep 2006
Posts: 8
|
Hi Forbes!
I'm sorry to disapoint you, but I do not understand everything in this script, it was premade. The only thing I have modified, is the file type, and that it saves the image instead of just outputing it to the explorer (as it would if you just use imagePNG($image)). So, I'm quite lost here ![]() Regards Vidar |
|
|
|
|
|
#4 |
|
It's been real...
![]() ![]() ![]() ![]() Join Date: Dec 2004
Location: Yorkshire, England
Posts: 537
|
Have you not tried getting in contact with the guy(s) that wrote the script?
That'd be my first port of call. Hope that helps? |
|
|
|
|
|
#5 | |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Nov 2005
Location: Moss, Norway.
Posts: 280
|
Quote:
I see potential problems here: flash.display.BitmapData Class Do not know the class, but do you have control of what it does? Output them as PNG files. Have you tried other formats? You write: "The problem is that some visitors have dark settings on their camera, and in the dark places in the image, the color becomes purple (so it looks like a negative of the picture)". Are you sure that the error is in the code? What about the libraries? You write: "Is there any simple solution to try ImagMagic instead of GD? (It is installed on my webserver)". May be I do not know them. Did you mean ImageMagick or ImagMagick? Natural KW search on Google: "PHP GD problem with PNG" or variations thereof. You are aware of this page http://no2.php.net/gd that says: Requirements If you have the GD library (available at http://www.boutell.com/gd/ ) you will also be able to create and manipulate images. Last edited by kgun; Sep 21, 2006 at 07:31. |
|
|
|
|
|
|
#6 |
|
SitePoint Member
Join Date: Sep 2006
Posts: 8
|
Hi Kjell Gunnar!
I will try to answer your questions breefly. The flash.display.BitmapData class passes the image as a HEX file, therefore the hex2int function. I have tried to output them as jpg and GIF, with the same problem. I don't really know if it is problems in the librarys (I'm guessing you mean Flash's libraries?), but it doesn't semm like that is the problem, cause after you have taken the snapshot, a image of that is shown to the right (in the flash aplication, the "Live" camera image is on the left, and the snapshot appears to the right), and this looks just fine. It is when the PHP script returns the image after convering it to PNG, the problem appears. Regarding ImageMagick, I ment http://www.imagemagick.org/ I have tried googeling (before posting to the forum), and I still can't figure out the reason... And I have GD 2.0.33 installed on the webserver. I appreciate all the answers here. Thankyou very much! Regards Vidar |
|
|
|
|
|
#7 | |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Nov 2005
Location: Moss, Norway.
Posts: 280
|
Quote:
You must then 1. Search for a better function or class or 2. Locate the part of the code that causes the problem. Have you asked on the other two large PHP forums? "http://phpbuilder.com/board/ http://forums.devshed.com/ If you are from Norway, somebody at the http://phpbb.no/ may also help you since I think there are som clever PHP guys there. It is difficult for me to help you more since I do not have the full code. It may be a colour / bitmap function, class that causes the problem. This site http://www.tufat.com/ also has a forum that you may try. As of this writing I get the following message: "The forum is temporarily down for maintenance". The site has a FlashChat. When locating errors in code I use the following technique: 1. Echo "I am here." 2. Output intermediate results. 3. In a nutshell, test the output of each transformation / mapping in each step. |
|
|
|
|
|
|
#8 |
|
SitePoint Member
Join Date: Sep 2006
Posts: 8
|
Hi Kjell Gunnar!
Thank you very much for your reply! I will take a look at the other forums, and post a message there! Regards "the Viking" Vidar ![]() |
|
|
|
|
|
#9 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Nov 2005
Location: Moss, Norway.
Posts: 280
|
The Norwegian company RefsnesData owns W3 Schools that I assume you know since it is one of the best known resources for webmasters. It has more than 30 million visitors / month.
Their forum may be the natural starting point. How did I forget that forum? A final word about technique: I do no know so much about image manipulation since it is not my business, but a natural KW search is: (Digital) Image Processing The expert groups are here: DSP Related Discussion Groups Here is a collection of image filters written in C++ that can be downloaded and perhaps translated to PHP. May be you should use a form of inverted filter, since the colour gets purple on the dark places. Then a natural search (class browsing see OopSchool in my signature for resources) becomes something like InvertedColo(u)r filter / method / function / class in PHP Last edited by kgun; Sep 21, 2006 at 19:30. |
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 14:46.










Hybrid Mode
