bahearn Posted July 30, 2009 Share Posted July 30, 2009 This is my script currently it uploads and re sizes images but when i try to upload and re size png, gif with transparent backgrounds the background color becomes black and is not transparent any ideas ? if($_SERVER["REQUEST_METHOD"] == "POST") { $image2 =$_FILES["file2"]["name"]; $uploadedfile2 = $_FILES['file2']['tmp_name']; if ($image2) { $filename2= stripslashes($_FILES['file2']['name']); $extension2 = getExtension($filename2); $extension2 = strtolower($extension2); if (($extension2 != "jpg") && ($extension2 != "jpeg") && ($extension2 != "png") && ($extension2 != "gif")) { $change='<div class="msgdiv">Unknown Image extension </div> '; $errors=1; } else { $size2=filesize($_FILES['file2']['tmp_name']); if ($size2> MAX_SIZE*2048) { $change='<div class="msgdiv">You have exceeded the size limit!</div> '; $errors=1; } if($extension2 =="jpg" || $extension2 == "jpeg") { $uploadedfile2 = $_FILES['file2']['tmp_name']; $src2 = imagecreatefromjpeg($uploadedfile2); } else if($extension2 =="png") { $uploadedfile2 = $_FILES['file2']['tmp_name']; $src2 = imagecreatefrompng($uploadedfile2); } else { $src2 = imagecreatefromgif($uploadedfile2); } list($width2,$height2)=getimagesize($uploadedfile2); $newwidth2=1024; $newheight2=768; $tmp2=imagecreatetruecolor($newwidth2,$newheight2); imagecopyresampled($tmp2,$src2,0,0,0,0,$newwidth2,$newheight2,$width2,$height2); $filename2 = "images/". $_FILES['file2']['name']; imagejpeg($tmp2,$filename2,100); $finished = "<font color=\"red\">Great, your files have been uploaded</font>"; }} } //If no errors registred, print the success message if(isset($_POST['Submit']) && !$errors) { } Link to comment https://forums.phpfreaks.com/topic/168149-php-gd-transparency-issue/ Share on other sites More sharing options...
phpSensei Posted July 30, 2009 Share Posted July 30, 2009 what browser are you using? IE or FF? Link to comment https://forums.phpfreaks.com/topic/168149-php-gd-transparency-issue/#findComment-886838 Share on other sites More sharing options...
bahearn Posted July 30, 2009 Author Share Posted July 30, 2009 right now I am using Firefox, but I need this to work on both ie 7 and Firefox thanks again, ba Link to comment https://forums.phpfreaks.com/topic/168149-php-gd-transparency-issue/#findComment-886848 Share on other sites More sharing options...
phpSensei Posted July 30, 2009 Share Posted July 30, 2009 http://www.vbulletin.com/forum/showthread.php?t=89472 read that thread and see if you can find your answeer Link to comment https://forums.phpfreaks.com/topic/168149-php-gd-transparency-issue/#findComment-886850 Share on other sites More sharing options...
bahearn Posted July 30, 2009 Author Share Posted July 30, 2009 Thanks, but it appears that on the server the actual created image file with my script loses the transparent background and changes to black, it is not an issue of showing the file as I am loading it into flash and flash will load transparent images correctly. thanks, ba Link to comment https://forums.phpfreaks.com/topic/168149-php-gd-transparency-issue/#findComment-886858 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.