GD: Testing A Pixle To See If It's Transparent?
How would I determine if a pixel is 100% transparent on a given image?
View Complete Forum Thread with Replies
Related Forum Messages:
PHP (GD) Created Transparent PNG: AlphaImageLoader Makes Black Parts Transparent Instead Of Transparent Color Set With PHP
I have a problem with PHP (GD) created transparent PNG and Microsofts AlphaImageLoader. You will immediately see what the problem is if you view http://www.useful-scripts.biz/test/.../transpng_2.php with IE 7 or Firefox and then with IE 6. It seems that the AlphaImageLoader works correctly on a PNG image that has been created with an image processor and then uploaded, but not with a PNG image created with PHP. It seems to ignore the transparent color set with PHP and instead to render the black color transparent. The image in question was created using this code: <?php $source = imagecreatefrompng("parrot_orig.png"); $transp = imagecolorallocate($source,255,0,0); imagecolortransparent($source,$transp); imagefilledrectangle($source,15,15,70,70,$transp); imagepng($source,"parrot_php.png"); ?> The HTML used on the page is this:
View Replies !
Transparent GIF
I am trying to resize transparent GIF images, so I was reading, and they say to use fopen, fread, and read the first 13 bytes... OK, so I read in a transparent gif, and the first 13 bytes... and echo it out to the screen, and I get this: GIF89a›�s�÷��What am I supposed to do with that? they then say "allocate that color as transparent, and use imagecopy(); to set the transparency back."
View Replies !
Transparent .png
This isn't totally related to php, but I am using a php generated page that is using transparent .png's. Anyway, when I view the page in Internet Explorer, the transparency within the png is replaced with grey?? But when I view it in Firefox it works fine?
View Replies !
Transparent Image
Hi! Here's a piece of code: [begin] <?php Header('Content-type: image/png'); $sz = ""; $FileValue = 1000; $i = strlen($FileValue); for ( $j = 0; $j < 7-$i; $j++ ) { $sz = $sz . "0"; } $Img = imagecreate(56,13); $Gold = imagecolorallocate($Img,148,128,100); $Gray = imagecolorallocate($Img,32,32,32); ImageFilledRectangle($Img,0,0,55,12,$Gray); imagestring($Img,4,0,0,$sz.$FileValue,$Gold); imagepng($Img); ImageDestroy($Img); ?> [end] OK. Calling this script I have a png picture back. Now I add imagecolortransparent($Img,$Gray); just before imagepng() and OK again, I have a transparent picture back. But now, if I add: $r = imagerotate($Img,90,0); imagepng($r); just after the imagecolortransparent() instruction seen above, I get a rotated picture, but not transparent. How to solve that? I've used a plenty of tricks, no one works.
View Replies !
Transparent GD Watermark.
Any one know what would be the best way to accomplish a transparent watermark on upload with GD that will work for Jpegs, Gifs and Pngs, using only GD in php 4?
View Replies !
Resize Transparent PNG
I have a basic script to resize a transparent png image. Code: $dimg = imagecreatetruecolor($newwidth, $newheight); imagecolortransparent($dimg, imagecolorallocate($dimg,0,0,0)); imagealphablending($dimg, false); imagecopyresampled($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); Problem is that my nice drop shadows are lost in resize. Does anyone know how I can keep them ?
View Replies !
Transparent Background
i'll try to explain myself the best i can, here is the problem: i have a html page and inside this i want to put an iframe that contains a php page. That's ok, i can do it and it works, but the problem is that i can't make that php document to have transparent background. it turns white. Is it because of the iframe? the php document has transparent background, but when i see it inside the iframe it doesn't work.
View Replies !
Two Transparent Colours
I have an image that I am opening and then merging onto another image, and it has two colours which I wish to make transparent, but it is not working, can you please give me an example of how to do this thanks. When I say that it is not working, I mean that when I allocate the second one, the first one is no longer transparent.
View Replies !
Transparent Overlay Watermark - On The Fly?
Is it possible to overlay a transparent watermark on an image - dynamically? I'd like the result to look like this example: <http://www.cycletourist.com/temp/photo.php> That is a bit of overkill, but you can see what I mean. The watermark image (a png image) is included separately below the photo. I tried using a class from phpclasses.org <http://www.phpclasses.org/browse/package/1580.html... but the result looks horrible. The transparency does not work. I found one other method through Google, <http://www.sitepoint.com/article/watermark-images-php> but it did not work, either. Can this kind of transparent overlay be done on the fly with GD lib?
View Replies !
Dynamically Transparent Gif's
Basically what i would like to do is dynamically set the transparency of a selection of images (GIF'S) depending on variables set in a My SQL Database. What i need to do is tint some jpg,s by setting the transparency of a solid blue gif which is set over the top of it in a table.
View Replies !
Imagegettftext Transparent Holes
I created an image, made it transparent, drew a rounded rectangle on it and then wrote on it with imagegettftext - where the text is there are transparent holes. $image = imageCreateTrueColor($width,$height); imageSaveAlpha($image, true); ImageAlphaBlending($image, false); $transparentColor = imagecolorallocatealpha($image, 255-$r, 255-$g, 255-$b, 127); imagefill($image, 0, 0, $transparentColor); $background = imagecolorallocate($image, $br, $bg, $bb); .......
View Replies !
Define The Transparent Color
I've made a script that takes images (in gif,jpg & png) and makes their thumbs in jpg format. Now, the problem is if I have a transparent gif when saved to jpg the part of the original picture that is transparent turns black in the new thumb. My question is: how can I define that the transparent part gets the color i want it to get (white is what i need) ? Actually, I now what in theory should be done. I should change the r,g,b values of the color that has aplha=127 (and that's not a problem with imagecolorset()), but also I should change the alpha of that color to 0. how can that be done ? My quess is that that is the right way to do it.
View Replies !
Transparent Watermarks On Images
I'm using the code below to make a watermark and it's kinda working, but I want it semi-transparent as the PNG file is itself. Is there an easy way of overlaying transparent images in the GD library, so that the original image is merged in such as way that it can be seen through the watermark? Code:
View Replies !
Make Thumbnail Transparent
I have a script that will upload an image, then create a thumbnail of that image. When I upload an image with a transparent background the normal sized image comes out with a transparent background, but the thumbnail image comes out with a black background. Code:
View Replies !
Transparent Text On Image?
Is it possible to place transparent text on an image? I want to display an image of some text in a fancy typeface, but superimpose text in a plain style, so that it can be copied and pasted; a bit like what you see in some PDF files, where the page image is visiable, the overlying text is not.
View Replies !
Transparent Filled Polygon
I'm working on a map program where each building is clickable and when it's clicked the page is refreshed to show a map with the building highlighted (in red). I was wondering if it would be possible to highlight the buildings using some sort of combination of the imagepolygonfill function and a transparency function (i'd like the buildings to still be visible under the highlight), rather than having to create many different files with the different buildings highlighted.
View Replies !
Make A Colour Transparent
I would like to do is grab an image, determine what colour is at a certain pixel (maybe 10, 10) and then set that colour to transparent for the whole image. Basically it is so that I can dynamically place an image on various backgrounds for previewing. I am not worried about perfection (anit-aliasing, matte, etc).
View Replies !
.htaccess Transparent SESHID And Sessions
just putting the finishing touches on a shopping site and have run into errors in the process when users are blocking cookies. i am using: <IfModule mod_php4.c> php_value session.use_trans_sid 0 </IfModule> in my .htacess file to supress the PHPSESSID=22y3213etc. but it means that if a cookie isn't set the site fails to work properly. if i remove that from my .htaccess the site works fine because the PHPSESSID is passed around evey page, but it knackers things for SEO purposes. Code:
View Replies !
GIF Resize Resample Transparent Fill
I am currently trying to create what I would think is simple. I want to create a image.php file and have it resize a 80 x 80 image to 29 x 29 with out losing the quality. When I try to have the gif image imagefill with the color white (255,255,255) it holds up and ends with a timeout. The gif images also have the black pixels if i don't try filling. Does anyone know a simple script to just resize a gif/jpg file? All documentation has been pretty bad so this is first time posting.
View Replies !
Create Or Resize Transparent .png - Drop Shadow - GD IM
I've searched and d/l'd but cant seem to find a way of creating a semi-transparent drop shadow for an image. Let me say, be fore I go on, I *do not* want one of those scripts that resizes your image a bit to the left and bottom, and then grafts a shadow onto it. I want to use a full shadow (it would be about as big as the image) and shift it a bit with CSS. So, I will have the image sitting in a DIV which will have the shadow as a bg. This works fine doing it manually. So, I would like to find one of two alternatives: 1. (best) Create the shadow from given parameters(size, darkness, spread, etc.) I will write the .png to a folder, I dont really need to create it dynamically each time, but want the ability for the future (galleries) and for when I'm in development and images are changing, moving around, etc. 2. (will work) Take a pre-existing shadow and resize it as needed, but has to keep the transparency.
View Replies !
How Do I Echo A Binary Array (transparent Pixel)
What am I doing wrong here? I want to display a transparent pixel... <? $transparent1x1 = array (71, 73, 70, 56, 57, 97, 1, 0, 1, 0, -128, 0, 0, 0, 0, 0, 0, 0, 0, 33, -7, 4, 1, 0, 0, 0, 0, 44, 0, 0, 0, 0, 1, 0, 1, 0, 0, 2, 2, 68, 1, 0, 59); header("Content-type: " . image_type_to_mime_type (IMAGETYPE_GIF)); echo $transparent1x1; ?>
View Replies !
Testing For Php?
How can I do testing in php? I just did a quick search and I cannot find too much info about it. The one sounds promosing is phpunit.de. Is it the right place?
View Replies !
Testing With IE 6 And IE 7
The problem that occurs is when you use the "check" validation for username and email address. We would like anyone with IE 6 and/or IE 7 to help us out and view this link to see what occurs from their end. Do you get a JS error? Does it work the way it should by displaying an ajax response such as "Username is currently available" Code:
View Replies !
Testing Of Var
I have two form fields called $bride and $groom which means the person need to type in both and then i want to test it in my MySQL database. What i've done is redirect the form to the same page which is the index.php page and then i said if ($submit) so now i want to test it in the database. but how can i bring up a popup menu if its not right and if it is how can it link directly to the wedding.php page with its variables without putting another button if its right.
View Replies !
Testing Php
I need somewhere to test my php. I cant pay for anything because im only 13, does anyne know about some sites where I can enter my scripts and get a preview of what they would look like.
View Replies !
PHP Testing
I would like to test some of my PHP scripts. Does anyone know of a free web hosting service that offers some PHP support (and maybe mySQL support). A long shot I know. But perhaps worth asking. Replies by stickymail please - no ads (even for free services) in the forum. P.S I will get paid PHP hosting in time. But just for this small interim period - anyone know of a free service? Or perhaps even just an online PHP script tester/debugger.
View Replies !
Testing For Empty Set?
basically, i want to query my db and see if the user has input a valid #.... if it matches a record im my table 'plu_coupons' then i will execute the code that allows a user to proceed... if the number input by the user does not match any of my records, he/she will be redirected to the sign-in page...
View Replies !
Help Regarding Testing Web Page
I have developed a website in my local machine using PHP, MySql and apache. It's not uploaded on the net. The pesrson for whom I have developed this wants to test it before actually putting it online on their website. How do I let her test it? Is there a way?
View Replies !
Testing If A Value Exists.
Im trying to create a function that tests if a 'Username' exists in a particular table. If the value is found then the code generates 'Username1' as the username, and check if that username exists. If it does, it continues onto generating 'Username2' and so on. <? //testing with username andrew $name = "andrew"; mysql_pconnect("server", "username", "pass"); mysql_select_db("db"); $result = mysql_query("SELECT Username FROM users WHERE Username = '$name'"); $num_rows = mysql_num_rows($result); if ($num_rows > 0): $count = 1; While ($num_rows > 0): //$username = $username.$count; $result = mysql_query("SELECT Username FROM users WHERE Username = '$name'"); $num_rows = mysql_num_rows($result); print($username.$count); $count = $count + 1; endwhile; //---- else: print("ok"); endif; ?>
View Replies !
Testing Cacheability
I have dynamic pages that get content from a database. I have written some code to send a last modified header when significant revisions are made in the content test. Found a site that tests this and improved from no info to the message below. have I accomplished anything as far as conveying to search engines that there is fresh content and what else do I need to do? This object doesn't have any explicit freshness information set, so a cache may use Last-Modified to determine how fresh it is with an adaptive TTL (at this time, it could be, depending on the adaptive percent used, considered fresh for: 2 days 14 hr (20%), 6 days 11 hr (50%), 1 week 5 days (100%)). It has a validator present, but when a conditional request was made with it, the same object was sent anyway. It doesn't have a Content-Length header present, so it can't be used in a HTTP/1.0 persistent connection.
View Replies !
Testing Mail
my server was on a windows system and as such I just setup my mail via php.ini. now that its on linux I had to setup sendmail. whats the driest/easiest/boiled down code to use/test if mail is working right.
View Replies !
Testing PHP Scripts
There are many things you will want to consider when testing your PHP scripts. Of course your main objective in testing a script is to make sure it works as expected. Also important, however, is security. There is a nothing worse for a website than a security problem. Any PHP scripts you write need to be tested thoroughly to make sure they are secure and that they will work under any condition the user can throw at them. Code:
View Replies !
Testing For Substring
I have a news headline grabbed from another page in the same site. The data is captured like so: $post=mysql_fetch_row($res2); $post=$post[0]; I then do a strlen analysis on $post, chop it off at $maxlen, and add ellipses. This all works fine. The problem occurs if $post contains <pre> data and the headline is chopped before the closing </pre> tag. The missing </pre> ruins the page layout for everything that follows. * The <pre> tag may or may not be present * If <pre> is present, it may or may not be at the beginning of the string I have looked at substr, strstr and strpos, but none of them seem to quite be what I'm looking for.
View Replies !
Testing Webpage
I think I've finished my website and I'd like to know if I can ask people to take a look at it to see if they get any errors but I don't know if I can do that. I wasn't able to find it in the FAQ or guidelines. So is this ok?
View Replies !
Testing Strings
How can I check a string is just made up of letters and hyphens. I've looked at preg_match etc but they don't seem to test for only letters and numbers.
View Replies !
Bb Testing Problems
I am testing phpbb on an apache system how do I test registration it doesnt email to user accounts, when I try to register with a previous account it doesnt let me fine. when I delete the user account from user table. it still tells me that the user is there but I havent even been able to set a new username at the registration page cause it doesnt even allow it to get past the age page without saying the user is already there.
View Replies !
Problem Testing Php
I've just installed php on 2003 and iis 6.0 for the first time. I'm quite sure i've done all the install correctly but when i created the test index.php test file and open a browser to check it i get the message No input file specified For info the index.php contains the following: <?php phpinfo(); ?>
View Replies !
Testing Number?
What's the best way to test if a value is a whole number greater than 0? If $quantity=2 is there a built in function or something test $quantity.
View Replies !
Testing Value Of DropDown Box
im setting the value of a dropdown box with : $Result2 = mysql_query($Query2, $Link); ?> <option value="" selected>All</option> <? while ($Row2 = mysql_fetch_assoc ($Result2)) { ?> <option value="<?=$Row2['eFrom']?>"><?=$Row2['eFrom']?></option> <? } mysql_free_result($Result2); ?> Theres more around it just a brief snippet, it loads fine after this is loaded im trying to test the value of the selected field. and well it doesnt seem to want to test with the code below. ive been looking and i cant find the correct syntax to test it. here is what im using anyone know the correct way to test this? Code:
View Replies !
Security Testing
I've been doing an online proofing system for the company I work for. It's not exactly complex but if someone with some PHP experience could test it out for security or give some guidlines on good ways to test it I'd appreicate it. The people who are likely to be using it will probably not have too much knowledge of the launguage so it doesn't need to be over the top secure, just enough. Basically, if you can do anything that obviously shouldn't happen to the database or see any of the other users data, hack into either the admin area or other accounts etc.
View Replies !
Localhost Testing Speed
I'm currently testing my PHP scripts in two locations. The first is my workplace, where I am using Windows 2000 SP4, and IIS. The other location is my home, where I also use Windows 2000 SP4 and IIS. The problem, is that when I run PHP scripts on my work PC, it takes a couple of seconds to display the page. But when I do exactly the same script at home, it is near instant. Are there any configuration changes I should make to IIS or something which may be different. The only real difference between the two machines, is that my work one is on a corporate LAN.
View Replies !
Testing For Empty Variables
I am retreiving the results from a randomized multiple choice quiz sent from a another php page using: foreach($_POST AS $field=>$value){ How do I check to see which questions were not checked?
View Replies !
|