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 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 !
String Of Text (Number Of Pixels / Pixel Size / Pixel Length)
If I'm putting together a list of links and I want to get add each item one at a time inside a foreach($aNames as $sName) loop, is there an easy way to get the number of pixels that the $aName takes up? For instance, in creating a set of links... foreach($aLinks as $sLink) { if ((pixelsize($sLink, $sFont, $iFontSize) . pixelsize($sHTML . " ", $sFont, $iFontSize)) < 400) { $sHTML .= " " . $sLink; } else { $sHTML .= "<br /> " . $sLink; } } The goal is to keep the whole link on one and only one line letting the browser automatically break up any given link..
View Replies !
Echo Binary
how can I echo the decimal number 0 instead of the ascii "0"? passthru can do it in response to a shell function. Is there another way? does echo pack("C", 0) do it?
View Replies !
Make A Greyscale Image Out Of Array, Scaled To The Maximum Pixel?
Can the GD library do this? I have an array of numbers (which I shall be manipulating server-side), which I wish to convert into an image. The elements of the array are essentially the 1D subscripts of a 256*256 image. I've been looking at the GD library functions all day, but I can't seem to translate the array to a jpeg or png or whatever. (The GD library functions are working though.) It seems that creating an image from another image is easy, but not from the raw data. How can I make a greyscale image out of this array, scaled to the maximum pixel?
View Replies !
Treating POST_VARS Array But Not Binary?
Would like to come up with a portable function that cleans user input for my database but don't want it to mess with binary data. anyone have ideas on this? I think i need a function to dectect if the $val is binary or a way to rewrite the $vals i pass to the function. perhaps PHP Code:
View Replies !
Print Image In Binary Array To Stdout
I'm still having the problem that I don't know how I can print the data of a jpeg image. I got the imagedata as return-value from a COM object. The imagedata are hold in a Variant SafeArray of bytes. Now I want to print the image header: header("Content-Type: image/jpeg") The php docs say, I should process these types in a foreach loop. So I try: foreach ($imgDataArray as $byte) { print decbin($byte); } When I try this on the commanline, I get: Content-Type: image/jpeg 11111111110110001111111111100000010000100101010001 101001001100011001100101001111...etc. This means: No binary image output. But the data signature is absolutely correct. I controlled it against the original jpg with a hex editor. I also tried some other ideas, but no succes.
View Replies !
Get Binary Data In Binary File
I know how to open a binary file with fopen('abc.dat', 'rb') but I don't how to get the data from it. I know the position (offset) of some long, interget, char and string. However I fail to get them by any method. I had trial fread, fgetc and fgets and fscanf but all false. Is there any function I was overlooked?
View Replies !
Echo Variable In Array
When I print this array I have (let's call it $image), I get the following... Printed output of $image array: Array ( [FileName] => large_thumbnail-0.jpg [FileDateTime] => 1180739942 [FileSize] => 186845 [FileType] => 2 [MimeType] => image/jpeg [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF, INTEROP, MAKERNOTE [COMPUTED] => Array ( [html] => width="500" height="375" [Height] => 375 [Width] => 500 [IsColor] => 1 [ByteOrderMotorola] => 0 [CCDWidth] => 5mm [ApertureFNumber] => f/3.2 [UserComment] => [UserCommentEncoding] => UNDEFINED [Thumbnail.FileType] => 2 [Thumbnail.MimeType] => image/jpeg ) ) How would I echo just the "html" field?
View Replies !
Echo Data From An Array
I am trying to echo text from an array but I can't seem to get the quotes right. Could some please look at this code and tell me what I am doing wrong? <?php if (@include(getenv('DOCUMENT_ROOT').'/openads/phpadsnew.inc.php')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ('zone:6', 0, '', '', Ɔ', $phpAds_context); echo $phpAds_raw['html']; } echo "$phpAds_raw['html']"; ?>
View Replies !
Ordering Array Echo
Is there a way to order this echo other that by the first character? I'm trying to find 2-3 ways to order this, rather than 1st letter alphabetically: $region = array("Midwest", "Northeast", "Southeast", "Southwest", "Northwest");
View Replies !
1 Pixel Web Bug
Im trying to read a cookie set by another domain from a site's thank you page, however i have found that i cannot read a cookie set by another domain. for example. user visits site A (cookie set) user is directed to site B user ends up at a certian page on site B (cookie A read and value passed back to site A) site A updates database I have seen some sites loading a 1 pixel image (google seem to do this with their conversion tracker) but when i try to do something like: <img height="1" Width="1" src="http://www.mydomain.com/tracker.php"> and my tracker.php script tries to read a cookie that was set on mydomain.com, it can't. <iframe src="http://www.mydomain.com/tracker.php">
View Replies !
Random Echo Array Elements
I have something like this: $colors=array("red", "blue"); And I want to randomly echo one of the things in the array. But let's say I want it to be more likely for it to be red than blue. I guess I could put red into the array twice, but is there a quicker way.
View Replies !
Search Array If Already Exists Than Don't Echo
I have a field that has picture tags in it, so some of them are the same as other tag rows, however I don't want to repeat all the tags over and over. So I want it to check and see if that tag was already echoed and if it was then don't echo it again. So I tried storing them in an array then searching the array for that value, however it didn't work at all... it is continuing to echo them regardless of being in the array or not. Any ideas? Code:
View Replies !
Pixel Color
I'm using PHP4.2.2 with gd on a Linux platform and am having difficulty in solving a little problem despite going through the definitions of the various image functions. If you load a true-colour image from a file using... $image=imagecreatefrompng("file.png"); ....how do you then get the red, green and blue values of a pixel at $x, $y within that image? I'm sure it's fairly simple but I can't find this from what I've read so far.
View Replies !
Pixel Tracking
I have a php website that tracks a users name and what link they click and I record this into a mysql database. I've recently setup with an affiliate program that allows pixel tracking and I wanted to record signups from that into my sql also. I know I can use a simple php script to do this, but how can I get it to also pass the users name? I don't think I'm explaining this right. Once a user clicks a link on my page it records that click under that persons username into my sql database. Then it brings up the affiliate page. Once someone fills out the form and clicks submit I can have a pixel tracking code in there to record but since I'm on another page it never passed the username so how do I record it into the right spot? Maybe using frames?
View Replies !
Random Pixel Generator
Im trying to create a program that generates random pixels from a set picture.. i know how to write a random number generator its just figuring out how to take that one step further and getting it to grab pixels from a picture and show them one by one when somebody clicks generate button. there needs to be 1,000,000 pixels in total. Raar my head hurts trying to think of a way to do it!
View Replies !
Image Pixel Border
I have a page that allows the user to specify a font, text, and size. Then the page displays it in a .png image for the font,text,and size they wanted. The image is transparent except for the text which is black. I want to be able to specify a border around the text. Is there a way to tell PHP to look for transparent pixels and colored (black) pixels and create 2 border pixels (red for instance) on the transparent side? All that I am using is: ImageColorTransparent($image,$background_color); with the background_color being white.
View Replies !
Image Resizing And Max Pixel Resolution
I have image resizing code that is resizing most of the time, apart from when then images are of a large pixel dimension i.e. width of over 2000 pixels even though image is just over 400KB so this wuld rule out the fact that the host provider has increased the max file size. The original image uploaded remains the original size - no resing occured. I need the image resize to work all of the time.
View Replies !
Pixel Color Detection Possibilites...
However, i've also heard that you can use PHP to determine the color of specific pixels - is this true? I'd be very interested in writing a script that takes a small image, say 100x100 and maps the color of each pixel to an array. Any thoughts? To be honest i'm really just looking to see if a pixel registers black or white. I can prepare the image to make sure it's either 100% black or white... where do I start? I'm eventually going to take this info and send it into flash and play from there.... anyone know how to do this? is it even possible? where do I start?
View Replies !
Image Resize - Center A 100 By 100 Pixel Box
I wrote and image resize script that keeps the same width height ratio as the orignal what I want to do is take the resized thumbnail and center a 100 by 100 pixel box on it so that my thumbnails are now 100 X 100. It would make my gallery look proportional and neatly in order. Code:
View Replies !
Determing Pixel Length Of String Server Side
I am trying to determine the width of a string in pixels on the server as it will be when the corresponding css has been applied on the client. The reason i need to do this is that I use fancy bevelled edge table and need to work out the string length in pixels to enable me to src the correct image. Using string length does not work because the database could contain the following. I AM A STRING i am a string As you can see the two strings when loaded on the client are different widths. There is no option to turn off case.
View Replies !
Tracking Pixel In A Processing Script, Instead Of HTML Page
I have a Web form that is filled out on my company's web site. When the submit button is pressed, the form data is posted to a PHP page that (in the background) inserts their information into a database, sends them a confirmation e-mail, etc. Once the form processing is done, the user is redirected to a Thank You Page. The thank you page has the following code in it: [code]..... This code adds the user to an opt-in list so that we can send them other products and services. THE PROBLEM: Some of our affiliates collect our user's form data on their Web site via a co-reg page, when this happens, they are posting the form contents to the form processing page on my server, but the user never sees the thank you page, so the IMG SRC code above is never displayed, and they are never added to our opt-in list. QUESTION: How would I insert the same code above in my form processing page (that processes in the background) so that the opt-in occurs on the form processing page, and NOT the thank you page?
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 !
|