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 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 !
Dynamically Populate Drop-down List And Dynamically Include Html File
We have a drop down list on a PHP page, with several product names, and when people click one item, we will refresh the same page with the product name as parameter, and in turn we want to include a HTML file into the content area of the same page. I know it is recommended to put everything into database, but we want the web site to be very "portable", so the drop-downlist and the content should both in text files. Let's say the drop-down list will be poplulated from the product.txt file, and there will be a file for each corresponding item in the drop-down list. From the user point of view, if he wants to add a new product, he will just need to open the product.txt file, and add a new line with the product name, "Laptop", then add a new text file named "laptop" in the same folder which contains the HTML fragment to be included in the content area. What is the easiest way to do this?
View Replies !
Resizing Gifs
Using this code to resize a .gif file and then place it in another dir. The file appears in the correct location and gets resized however it is black..... this code works fine for jpegs when imagegif is changed to imagejpeg etc. Any ideas on a way round this or some code what resizes gifs that works would be great too.. <?php $new_width = 300; $new_height = 250; $imgname = "test.gif"; $size = GetImageSize("$imgname"); $img_in = imagecreatefromgif("test.gif"); $img_out = imagecreate($new_width, $new_height); ImageCopyResized($img_out, $img_in, 0, 0, 0, 0, $new_width, $new_height, $size[0], $size[1]); imagegif($img_out, "tempimages/testsmall.gif"); ImageDestroy($img_in); ImageDestroy($img_out); ?> <img src=test.gif> <img src=tempimages/testsmall.gif>
View Replies !
Reading Gifs
I know current versions of GD cant write gifs, however can they read them? Im wanting to convert some images to jpegs, is this possible?
View Replies !
Gifs Via Email ?
I would like to set up a page whereby I can select 1 gif from a selection and then email it to a recipient. Is there a function whereby I can do that ?
View Replies !
Problems In IE With Created Gifs
Wondering if anyone else has had problems with gifs created by php or if anyone sees a problem with this code. Symptom: created jpegs work fine and created gifs work fine in Netscape and Firefox and when directly viewed. IE displays gif fine *via internet* BUT off of a CD or local HTML file it won't display the file. I have run a dozen gifs through the process and it has happened to every one of them. function thumbnail ($src_file, $path) { $orig = $path . '/' . $src_file; list($w,$h,$type) = getimagesize($orig); if ($type == 2) { // jpeg $src_img = imagecreatefromjpeg("$orig"); $name = "thmb_" . $src_file; $thmb_and_path = $path . $name; if(!file_exists($thmb_and_path)) { $image_info = getimagesize($orig); $src_width = $image_info[0]; $src_height = $image_info[1]; $dest_height= 80; $dest_width = ($dest_height/$src_height) * $src_width; $quality = 30; $dst_img = imagecreatetruecolor($dest_width,$dest_height); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height); imagejpeg($dst_img, $thmb_and_path, $quality); chmod("$thmb_and_path", 0777); imagedestroy($src_img); imagedestroy($dst_img); } } else if ($type == 1) { // gif $src_img = imagecreatefromgif("$orig"); $name = "thmb_" . $src_file; $thmb_and_path = $path . $name; if(!file_exists($thmb_and_path)) { $image_info = getimagesize($orig); $src_width = $image_info[0]; $src_height = $image_info[1]; $dest_height= 80; $dest_width = ($dest_height/$src_height) * $src_width; $quality = 30; $dst_img = imagecreatetruecolor($dest_width,$dest_height); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height); imagejpeg($dst_img, $thmb_and_path, $quality); chmod("$thmb_and_path", 0777); imagedestroy($src_img); imagedestroy($dst_img); } } return $thmb_and_path; }
View Replies !
GIFs Preserving Transparency
I want to resize uploaded GIF images. Currently I do it like this: <?php // ... $img = imagecreatefromgif($path); $img_scaled = imagecreate($new_width, $new_height); imagecopyresampled($img_scaled, $img, 0, 0, 0, 0, $new_width, $new_height, $old_width, $old_height); imagegif($img_scaled, $new_path); // ... ?> This works like expected except for transparency, which is gone after the resizing. Furthermore the resulting smaller image doesnt appear to be resampled nicely. For me its looking exactly like the result of imagecopyresized(). I think this has something to do with the paletted nature of GIFs but Im far from an expert in image manipulation. What I want is a nice looking (i.e. resampled) downsized GIF with transparency if the original image did have it.
View Replies !
Creating Images From Gifs, Jpegs. Pngs
I have created colourfull images of characters of letters. by using a form i want to create words. the words will be a image. For exemple "word" is 4 letter. İnstead of 4 diffeen picture. Only one picture. i have tried with createimagefromgif function php but i couldnt.
View Replies !
Has Anyone Had Problems With IE Not Showing Thumbnailed Gifs When Firefox And NN Show Them Fine?
Wondering if anyone else has had problems with gifs created by php or if anyone sees a problem with this code. Symptom: created jpegs work fine and created gifs work fine in Netscape and Firefox and when directly viewed. IE displays gif fine *via internet* BUT off of a CD or local HTML file it won't display the file. function thumbnail ($src_file, $path) { $orig = $path . '/' . $src_file; list($w,$h,$type) = getimagesize($orig); if ($type == 2) { // jpeg $src_img = imagecreatefromjpeg("$orig"); $name = "thmb_" . $src_file; $thmb_and_path = $path . $name; if(!file_exists($thmb_and_path)) { $image_info = getimagesize($orig); $src_width = $image_info[0]; $src_height = $image_info[1]; $dest_height= 80; $dest_width = ($dest_height/$src_height) * $src_width; $quality = 30; $dst_img = imagecreatetruecolor($dest_width,$dest_height); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height); imagejpeg($dst_img, $thmb_and_path, $quality); chmod("$thmb_and_path", 0777); imagedestroy($src_img); imagedestroy($dst_img); } } else if ($type == 1) { // gif $src_img = imagecreatefromgif("$orig"); $name = "thmb_" . $src_file; $thmb_and_path = $path . $name; if(!file_exists($thmb_and_path)) { $image_info = getimagesize($orig); $src_width = $image_info[0]; $src_height = $image_info[1]; $dest_height= 80; $dest_width = ($dest_height/$src_height) * $src_width; $quality = 30; $dst_img = imagecreatetruecolor($dest_width,$dest_height); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height); imagejpeg($dst_img, $thmb_and_path, $quality); chmod("$thmb_and_path", 0777); imagedestroy($src_img); imagedestroy($dst_img); } } return $thmb_and_path; }
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 !
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 !
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 !
How To Dynamically Name Variables?
Lets say I have variables named: name1, name2, name3, and name4. How can I call them without having to name them everytime. Something like for ($i=1; $i<=20; $i++){ if $"name".$i { do this } I've tried everycombination I can think of, but am totally confused. I had no trouble naming the variables dynamically in a form, but I can't get php to call them dynamically.
View Replies !
PHP To Dynamically Generate XML
I am interesting in using PHP to dynamically create an XML document and then use XSLT to transform to XHTML. I have come across two methods for doing this. I made two equivalent examples so you can see what I mean. http://members.shaw.ca/petermichaux...SLT_method.html I am interested in critisim of how I implemented each method. However my main problem is deciding between methods. Which method is better for bigger programs where the bits of the XML data are assembled by various php functions that I write? For example, one php function queries a database table for a list of CD titles. A second php function loops through this CD title list and gets the track listing for each CD from another table in the database. Then the composite XML data (ie. CD title and tracks as nodes) can be tranformed to XHTML.
View Replies !
Dynamically Edit SQL
I would like to have my results of an SQL query populate a tabel, which i have already set up and is functioning well. However now i would like to have another page, where the informatino is editable. What do you guys think the best way to set up a table that a user can edit the information in a SQL database without entering PHPmyAdmin?
View Replies !
Dynamically Build
I am using php/mySQL to display a photo gallery. I have it working OK at the moment if I want to display all photos from the database. However I would like to smarten up the page a bit. Each of the photos in the database are arranged into catagories so I would like to use a drop down menu to allow the user to filter the photos by Catagory. My plan would be to build a drop-down menu based on the catagories stored in the database. The user would select the catagory then use a submit button to rebuild the page with the new filter as part of the query. 1) How do I dynamically build a drop-down menu. 2) If the user selects an option from the drop-down menu how do I store the value selected and use it to filter the MYSQL query.
View Replies !
Dynamically Loaded
I anticipate wanting PHP to evaluate a lot of expressions and would rather not create subprocesses to do it from inside my C program. I've googled around for calling PHP from C, and know Apache does it, but my C program won't have a full Apache environment. Can the libphp.so be used otherwise?
View Replies !
Dynamically Determines
I want to create a page that dynamically determines how many fields the next page (a form) will have. Example, first page is "How many fields do you want?" with a drop down... user chooses a number from the drop down, the next page has a number of blank fields equal to the number the user selected on the first page. Is this possible? If so, how would you do something like this?
View Replies !
Dynamically Typed
Why scripting languages are dynamically and weakly typed? and why none of the scripting languages is compiler based? why cant a scripting language be use like java or c++ where we can catch type errors e.g. (string being assigned to an integer), parameter passing at compiled time. what is the significance of multiple dollar sign ($$...$var) in php? e.g. $var = "profession"; $$var = "doctor"; $$$var = "khalid"; and so on...
View Replies !
Dynamically Showing
I'm not sure if this is done with JavaScript or a combination of serverside and JavaScript, but how is it possible to setup a link that when clicked, dynamically shows content. then when clicked again, hides that same content.
View Replies !
Dynamically Xml Files
I've got a site where thousands of users add comments. I want them each to have an XML feed of their own comments. However I would like to do this dynamically so that I don't have thousands of xml files sitting on my server. I have a shared hosting account so I don't have access to root, conf, php.ini etc. What I would like to do is be able to set up feeds like this: http://domain.com/rss/USERNAME. Where any folder inside the rrs directory acts as the username that determines which feed to pull.
View Replies !
Dynamically Pulling
Alright I'm not a guru at php but I have a decent grasp on the capabilities of it. I want to be able to have a text only site to go along with my website. Is there any way to gather certain areas of text from my main site and display them in the text-only site. My website is growing so big that making updates to both of the sites has become very tedious and time consuming.
View Replies !
Dynamically Update
I am trying to dynamically update the $message parameter using mail(). Basically I want the $message parameter to use either an html, or php document to fill the body of an email. I have tried using include(), but instead of sending the body of the email to the user, it sends a blank email and you immediatly see the page that I have called to include in the browser.
View Replies !
|