Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Find Out If An Image Is A Transparent Gif


Does anybody know if there's an easy way to find out if a given image is a transparent gif? (GIF89a)




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 !
Creating Image From Uploaded Image And Transparent PNG
Say the client wants to be able to change the image, but not the text treatment, and doesn't have the Photoshop knowledge to actually replace it and re-save it themself.

Is there anyway to use a PNG with the rounded edges, text treatment, and transparent center, have the client upload a standard rectangular-shaped image, and use PHP to layer the uploaded image underneath the transparent one, creating a new image file?

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 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 !
Add Transparent Copyright Text To Image
I need a way to add a transparent copyright message (e.g. copyright 2002 together with my company logo) to my photos on the fly. My photos come in many different formats, such as PNG, GIF and JPEG.

View Replies !
[GD]: Open Existing Image(url) & Set A Transparent Color
lets say i output an image like this:

$img = array('somedomain.com/foo.jpg');

<img src="$img[0]" alt="" />

but it has a white background and i want to strip the white background to be transparent

how do i do that and output it inline again?

View Replies !
Remove A Black Background From An Image To Make It Transparent Using GD
is it possible to remove a black background from an image to make it transparent using GD. for example. can i pass the radius of the moon to GD (as it is on the image) and have it slice the moon out so to speak leaving it on a transparent background.

View Replies !
Cant Find Image To Redraw?
I have a php script that I need to go into my MYSQL database, pull out the name of an image and then using PHP's ability to redraw images, have it redraw it inside a table. I have been getting these errors:
Warning: imagecreatefromjpeg(IMG_0146.JPG ): failed to open stream: No such file or directory in /var/www/html/index.php on line 13
Warning: imagejpeg(): supplied argument is not a valid Image resource in /var/www/html/index.php on line 19

The PHP page and all the images are in the same directory. PHP Code:

View Replies !
Find Image Height
<?php
//somehow get height and width before the following..

if($image_height>$image_width)
{
$sizes = "height="100"";
}
else
{
$sizes = "width="100"";
}
?>

View Replies !
Find Characters In Image
I am trying to figure out how WhatTheFont is able to find characters in an image and find fonts that match them closely. I'd be happy with the first part for now. I am thinking they are using PHP's GD Library to open the image but does anyone know how I'd go about finding the character and identifying them.

View Replies !
How Can I Find The Number Of Channels In An Image ?
I would like to know how many channels an image has. The image may be a BMP, JPEG, PNG, or any number of other formats (but these are the most common). The image might also have an ALPHA channel.

The image might be compressed (like in PNG - you can decide how compressed you want the image to be). At first I used the "getimagesize" function to retreive the number of channels, but I realised :

1. It some times returns 0.
2. In images with an ALPHA channel - it doesn't count that channel.

View Replies !
Image Resize, Trying To Find The Final Size?
I use a function to set some maximum image dimensions for display on a page.That works fine but now I trying to find out what the final dimensions would be after the resize function and finding myself stuck. PHP Code:

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›&#65533;s&#65533;÷&#65533;&#65533;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 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 !
Take The Height Of An Image And Depending On The Height Find The Width That Corresponds To It
Is there a way to take the height of an image and depending on the height find the width that corresponds to it by a ratio and cut out any extra width? Then take that image and resize it to a desired width/height, that is the same ratio. Code:

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 !
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 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 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 !
Security - Detect If A Client Is Connecting Through A Proxy(inluding Transparent) Or Not.
I want to detect if a client is connecting through a proxy(inluding transparent) or not.  What measures can I take to authenticat the source of the request before I even ask for login details. $_SERVER['REMOTE_ADDRESS'] is the only thing I can think of using but surely it is not sufficient to trust its value.

View Replies !
Put Transparent Layer That Disable Page Element At The Time Of Processing Ajax
I have made web page in php with the help of ajax and javascript. I want to do whenever page processing for ajax for that time I want to put some transperent layer that will disable the back pages element.. I have seen one site but I dont remember.

View Replies !
How Do I Get The Image Height Width When Generating Image From PHP (getimagesize Does Seem To Work)
Is it possible to obtain the width/ height of an image when that image
is dyanically created using a PHP script and passing GET attributes.
For example:

<img src="images/showImage.php?image_id=5" />

My images are created from images stored on the server, their paths
stored on in database table and retrieved using the GET image_id and
PHP script (showImage.php). Because the images are different sizes I
would like to be able to use a PHP function / class that can take an
image path and generate the IMG width and height attributes. This
would just tidy up the page when loading.

So when I try to use PHP 'getimagesize' like so:

$wh = getimagesize ($_SERVER['DOCUMENT_ROOT'] . "/images/showImage.php?
image_id=5");

.... I get an error saying that the file or directory does not exist:

Warning: getimagesize(/customersites/0/home/httpd/vhosts/
mydomain.co.uk/httpdocs/images/showImage.php?image_id=5): failed to
open stream: No such file or directory in /customersites/0/home/httpd/
vhosts/mydomain.co.uk/httpdocs/classes/html.class.php on line 11

I thin it may be the GET atttribute that is throwing it. How would I
go about doing this?

View Replies !
Determine Image Information On Image Stored In MySQL BLOB
I store images in my DB as BLOB. When I want to place them in an html
table, I want to determine the width of the image in order to asign the
correct width to the column inside table.
For JPEGs this is working fine, this is my code:

$image = @imagecreatefromstring($r["foto"]);
return @imagesx($image);

where $r["foto"] is the field selected from the db which contains the image.

For GIFs however, its getting really on my nerves !!
I know imagecreatefromstring is not supported in gd2 and I tried several
thinks. None of them worked ! :
-
$temp = tmpfile();
list($width, $height, $type, $attr) = getimagesize($temp);
echo $attr;

gives me :Warning: getimagesize: Unable to open 'Resource id #6' for reading
-
$handle = fopen("/tmp/tmp.dat", "w+");
fwrite($handle, $r["foto"]);
list($width, $height, $type, $attr) = getimagesize($handle);
echo $attr;

gives me : Warning: getimagesize: Unable to open 'Resource id #6' for
reading
-
Doing this with imagecreatefromgif($temp); wont work either !

Can somebody help me out please? by telling me what I'm doing wrong or what
I should do.

View Replies !
Script To Post A Placeholder Image If Image Is Not Found On Server
I'm creating a site with an archive of photo galleries, and on each gallery page i'm looking to have a sidebar that shows a cross-section of other galleries in groups of 10, via thumbnails... except that sometimes, the updated galleries won't actually be there yet, so i'd like to have a script that basically looks for "set053/001.jpg", and if that image hasn't been uploaded, then a placeholder image saying "coming soon" would be shown. Ugh, that's a horrible descrition. Here's the outline of it:

-Say there are 52 photo sets (updates will be made regularly).
-If you're on any gallery between 1 and 10, this "sidebar" will show thumbnails of the other galleries within that group of 10.
-On a gallery between 11-20, you'll see the sidebar thumbnails for galleries 11-20... and so forth.
-But on the most recent set of 10, in this instance galleries 51-60, the galleries 53 thru 60 haven't yet been uploaded, so having a static sidebar that shows "galleries 51-60" would yeild broken images for the thumbs for 53 - 60 right now.

So hopefully that made more sense... basically, if PHP can find "set053/001.jpg" on the server, it shows it. If it can't, then have it show something like "images/comingsoon.jpg".

View Replies !
Make Like An Image With A Preset Image In Backround And Some Text In Forground.
I have been reading this book and its been trying to explain the uses of the gd library. now i understand you can create images to be output. now how do i go and make like an image with a preset image in backround and some text in forground.

View Replies !
Writing A Blob Image Out To A File - Jpg Image Looks Weird?
I've got simple watermarking working. I write a Blob image out from my db to a temp file and then overlay the watermark image to create 1 whole image.

The watermark is perfect, but the exported blob behind it looks all garbled - parts are visible but its not right!

I've looked at the temp file thats created by the line "fwrite($t_img, $data);" and the image looks corrupt, but displaying this field using usual php methods the blob looks fine.....

Here's the code :-

@MYSQL_CONNECT("$server","$user","$password");
@mysql_select_db("$database");
$query = "SELECT image, mime_type, image_width, image_height FROM items WHERE ID='$id'";
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0,"image");
$type = @MYSQL_RESULT($result,0,"mime_type");
$image_width = @MYSQL_RESULT($result,0,"image_width");
$image_height = @MYSQL_RESULT($result,0,"image_height");
// Write blob data out to temp image file to prep for Watermark
// creating a temp image name
$t_img_name = tempnam ("./temp", "timg");
$t_img = fopen($t_img_name, "w");
// $content is the blob field with the image.
fwrite($t_img, $data);
fclose($t_img);
//-$size = getimagesize($t_img_name);
//echo $size[0]." - ".$size[1];
$img = imagecreatefromjpeg($t_img_name);
$watermarkImage = 'images/watermark2.png'
$x = 165;
$y = 130;
imagesetbrush($img, imagecreatefrompng($watermarkImage));
imageline($img, $x, $y, $x, $y, IMG_COLOR_BRUSHED);
imagejpeg($img);
// End of watermark protection
// don't forget to delete the temp file after all.
//unlink($t_img_name);
$type = "image/jpg";
if(strlen($data) < 1) {
header("Location: ./images/nopicsubmitted.jpg");
} else {
//header("Content-type: $type");
header("Content-Type: application/octet-stream");
echo $img;
}

Can anyone spot if i've made a mistake, used wrong function or syntax etc?

View Replies !
Change The Image Size (resolution) Of An Image Upload?
how can i change the image size (resolution) of an image upload? For example: i upload an 320x240 jpeg image. I want to automatic resize this image also to: 160x120 and 80x60.

View Replies !
Resize Uploading *.gif Image For Image Display And Thumbnail
how to resize the uploading *. gif image...for display image size and thumbnail size...Okay I know how to do a uploading image...only for resizing part kind of lost it...because I find all tutorial not suit for what I look after..Ok the idea is..

when I upload image ..the php will resize the image into two type size and put into two folder "folder for images" and "folder for thumb" and size for all this type of image are...images = 100x100 thumb = 80x80 with same name file.

View Replies !
How Do You Detect Image MIME Type Of An Image In A Directory?
How do you detect an image MIME type if you know of the image in a
directory? For example, I know of:

Code: ( php )

View Replies !
Resize Uploaded Image To A Circular In Shape Image.
I have a doubt. Using PHP  Image Manipulation  I want to resize uploaded image to a circular in shape image. Is it possible? If yes means how to do it!

View Replies !
Creating Watermark With Another Image & Resizing Watermarked Image
I have a script that watermarks an image; it adds a transparent gif over my base image. I also have a script to resize my image. But here is where the problem comes in; these are two different scripts - none of the code will interconnect (variable wise - that is), so I am having a problem trying to piece together a PHP GD Image code that will create a watermark and will then be resized. Below is my code for resizing my image, but from there - I know I need to use imagecreategif somewhere and imagecopy somewhere; but where, I do not know. Code:

View Replies !
Pulls An Image From A Database & Displays It In Print $image;
I have a routine that pulls an image from a database & displays it in print $image;

all works great however... Is there a way that i can set the size params of the image as when i set width & height is just returns a load of chars instead of the image itself.

View Replies !
Image Upload Query - Image Not Uploading To Server?
I have the below file upload script which seems to add the path to the database fine but it wont put the file onto the server and I cant see whats wrong. Code:

View Replies !
How Do I Find Even #'s In Php
ur prob. all laughing at this easy *** question ... but for some reason i cant fig. it out.

i know how to find even (and odd) numbers in c++ (using the %).

how the hell do u do it in php tho...

im trying to alternate the bgcolor of a row in a table (from #CCCCCC to #FFFFFF)

here is my code..

if ($row = mysql_fetch_array($result)) {
$x=0;
echo "<table width=200 border=1 cellspacing=0 cellpadding=4>";
do {

if (($x%2)==0){$color="#FFFFFF";}
else {$color="#CCCCCC";}
echo "<tr bgcolor=$color><td>";
print $row["name"];
print ("</td><td>");
print $row["email"];
print ("</td></tr>");
$x=$x+1;
} while($row = mysql_fetch_array($result));
print ("</table>");
} else {print "Sorry, no records were found!";

View Replies !
How To Find IP?
Mostly when u visit shopping carts n u checkout n go futher for
payment in the list box your desired country is selected automatically
this is bcoz of they are tracking us by our IP Address.
So which function in PHP is used for find the IP Address of a person
who is visiting my site?

View Replies !
Find An Url?
I'm trying to read url's off of a website page by reading it's source code and locating http://www..com/? etc.

<embed src="http://www.somewebsite.com/someflash.swf" width="somewidth height="someheight">

Is it possible to locate a code in the source of a web page, except the exact link "http://www.somewebsite.com/someflash.swf" can be replaced with like %%%%%%%%%% so it simply finds it's similiar match? Otherwise I need to put in the exact url, and I want to search for all http urls instead.

View Replies !
Find A
I have a text feild where data is pasted:

Corners 9 8
Header 10 9
Goals 1 3

What would be th best way to parse this data so I can see cornera = 9 and cornerb = 8.

View Replies !
Find [ % ]
if I wanted to find any items in an array starting with [ and ending with ] how would I go about it? I amm building an email queue processor and I want to be able to place email address or distribution list names. eg if I had a list.. chris@domain.com, john@domain.com, [maillist_1] PHP Code:

$email_to = "chris@domain.com, john@domain.com, [maillist_1]";
$email_to = explode(",", $email_to);
foreach($email_to as $to_emails)
    {
        // First Check if its a distribution list
        if($dist == "yes")
           {
             // get the list and split them.
             $emails_to[] = $to_emails;
            }
        else
             {
                  $emails_to[] = $to_emails;....................

View Replies !
How To Find Url Php
Hello all,If my site has two domains, but domain one should point to french which already works.but domain 2, how can I check the url and if url is let's say domain2.com then add lang=en to the query string.



View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved