Jump to content

benjrox

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by benjrox

  1. Hi, I have a script that phases a chat log from a IM program to HTML, but when the chat log is bigger then 100KB (I think) it doesn't display a thing. Anything lower works perfectly. Here's the code: PHP: [code] $pext = getFileExtension($log_name); $pext = strtolower($pext); if ($pext != "txr") { unlink($log); die("Bad file type, please upload a Log file (.txr only)."); } else {         $handle = fopen($log, "r"); $contents = ''; if($handle) { while (!feof($handle)) { $contents .= fread($handle, filesize($log)); } echo fix($contents); fclose($handle); } }[/code] Upload HTML: [code]<form method="post" enctype="multipart/form-data" action="<? echo $PHP_SELF ?>">   Log file (.txr):   <input type="file" name="log" size="30" />   <input type="hidden" name="action" value="1">   <br />   <br />   <input type="submit" value="View Log"> </form>[/code] Thanks, Benj
  2. I noticed on a few sites, they use a "_fcksavedurl="<url>"" thing in their image tag. Does anyone know what it actually does?
  3. Hi, I currently have a table thats 100% high, and a <div> inside which I want to be 100% high, but not break out of the table where there's more then a page of content. You can see what I mean here: [a href=\"http://benjrox.magazinefashion.org/subsites/unblack/index.php\" target=\"_blank\"]http://benjrox.magazinefashion.org/subsite...black/index.php[/a] The HTML: [code]<div style="overflow-x: hidden; overflow-y: auto; height: 100%; margin: 10px; text-align: left; margin-right: 0px;">[/code] Basicly, I just want a page that has no page scroll bar, just the div. Thanks! Benj
  4. Don't worry, I fixed it. I just set a PNG with 50% alpha as the background :)
  5. Ahh, thanks, haha I assumed my original $img was the resource. I only started to learn about the image command yesterday :p Thanks :)
  6. Hi, I'm trying to generate a random image using this code: [code]<?php $dirname = "/home/www/benjrox.net/subsites/myspace/images/bg/resized/"; if ($handle = opendir($dirname)) {     while (false !== ($dir = readdir($handle))) {         if ($dir != "." && $dir != "..") {             $bgcount++;               }     }     closedir($handle); } else {     die("Could not get a directory list"); } $randimg = rand(1,$bgcount); $img = "/home/www/benjrox.net/subsites/myspace/images/bg/resized/bg". $randimg .".jpg"; header("Content-type: image/jpeg"); imagejpeg($img,null,100); imagedestroy($img); ?>[/code] Except I keep getting this: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<br /> <b>Warning: imagejpeg(): supplied argument is not a valid Image resource in [b]/home/www/benjrox.net/subsites/myspace/images/bg/img.php[/b] on line [b]22[/b] <br /> <b>Warning: imagedestroy(): supplied argument is not a valid Image resource in [b]/home/www/benjrox.net/subsites/myspace/images/bg/img.php[/b] on line [b]23[/b] [/quote] The images exist, it just doesn't work [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /] Thanks, Benj
  7. Hey all, On my MySpace, I have some tables that have 50% opacity. They work well in IE, but not Firefox. The code I'm using is: CSS: [code].50trans {     background-color: black;     opacity:.50;     filter: alpha(opacity=50);     -moz-opacity:0.5; }[/code] HTML: [code]<div class="content">                     <tr>                       <td class="50trans">                         <table>                         <tr>                           <td>                             <tr>[/code]My MySpace address is: [a href=\"http://www.myspace.com/roozbenjrox\" target=\"_blank\"]http://www.myspace.com/roozbenjrox[/a], if you want to compair in IE and FF. Thanks! Benj
  8. Well, that was tough, finally figured it out, thanks to some helpful php.net user comments :) Here's what I had to do: [code]<?php      function watermark($sourcefile, $watermarkfile) {         $watermarkfile_id = imagecreatefrompng($watermarkfile);           imageAlphaBlending($watermarkfile_id, false);      imageSaveAlpha($watermarkfile_id, true);         $fileType = strtolower(substr($sourcefile, strlen($sourcefile)-3));         switch($fileType) {          case('gif'):              $sourcefile_id = imagecreatefromgif($sourcefile);              break;                       case('png'):              $sourcefile_id = imagecreatefrompng($sourcefile);              break;                       default:              $sourcefile_id = imagecreatefromjpeg($sourcefile);      }        $sourcefile_width=imageSX($sourcefile_id);     $sourcefile_height=imageSY($sourcefile_id);     $watermarkfile_width=imageSX($watermarkfile_id);     $watermarkfile_height=imageSY($watermarkfile_id);         $dest_x = ( $sourcefile_width / 2 ) - ( $watermarkfile_width / 2 );      $dest_y = ( $sourcefile_height / 2 ) - ( $watermarkfile_height / 2 );           if($fileType == 'gif') {          $tempimage = imagecreatetruecolor($sourcefile_width,                                                                              $sourcefile_height);                   imagecopy($tempimage, $sourcefile_id, 0, 0, 0, 0,                              $sourcefile_width, $sourcefile_height);                   $sourcefile_id = $tempimage;      }         imagecopy($sourcefile_id, $watermarkfile_id, $dest_x, $dest_y, 0, 0,                          $watermarkfile_width, $watermarkfile_height);         switch($fileType) {             case('png'):              header("Content-type: image/png");              imagepng ($sourcefile_id);              break;                       default:              header("Content-type: image/jpg");              imagejpeg ($sourcefile_id);      }                 imagedestroy($sourcefile_id);      imagedestroy($watermarkfile_id);        }      $pngFile = "bgtop2.png";   $bgFile = $_GET["img"] .".jpg";      list($pngW, $pngH) = getimagesize($pngFile);   list($bgW, $bgH) = getimagesize($bgFile);      $bgImg = imagecreatefromjpeg($bgFile);      $im = imagecreatetruecolor($pngW, $pngH);   imagealphablending($im, false);   $col = imagecolorallocatealpha($im, 0, 0, 0, 127);   imagefilledrectangle($im, 0, 0, $pngW, $pngH, $col);   imagealphablending($im, true);      imageCopyResized($im, $bgImg, 0,0,0,0,$pngW,$pngH,$bgW,$bgH);      imagealphablending( $im, false );   imagesavealpha( $im, true );   imagejpeg( $im, "images/bg/resized/". $_GET["img"] .".jpg", 75 );      watermark("images/bg/resized/". $_GET["img"] .".jpg","bgtop2.png");      ?>    [/code]
  9. Wait, I remember the other problem that could cause it. Edit: Forgot to give a reason why it was happening :P Well, new lines for some reason, sometimes create spaces, which make extra lines on the outcome of the webpage. The easiest way to fix it is to delete all new lines after <td> and before </td> That should work, good luck :) Benj
  10. There might be something in the common.php or clsMetaContent.php that's adding the extra space, because I don't see anything that could cause extra space, whats in those file by the way?
  11. I still think it's the DOCTYPE, I tried mutiable browers with my website that was having problems. IE worked fine, Firefox didn't work to well, Konquour worked badly. I added that line, and they all worked fine. No, I'm not saying learn XHTML, it's 95% the same as HTML, most of the HTML works of XHTML. But I'm not sure what could be the problem if the DOCTYPE isn't it. Oh, and I'm not to sure about this, but if you don't include that line, most browsers set the default to HTML? Is that right? Or does it work as XHTML?
  12. I had the same problem, really annoyed me, I "accidently" found the solution. It is this line: [code]HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">[/code] You could either stick with HTML or move up to XHTML, might require some practice getting used to it (if you don't already know it that is [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]) but anyways, try replacing that with: [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/code] Should fix some problems, might make some new problems, depending on your HTML code. If all else fails, go back to HTML 4.01 :) I don't know the correct doctype code for HTML 4.01, so you'll probably have to look it up. Sorry. Good luck, Benj
  13. Haha, naturally, my eye's go for the code before the text, so I read you siguture first. I was going to say "ereg_replace" but I guess you worked it out [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /] Well, actually ereg_replace may not be the right way, anyway, it was the first thing that poped into my head before I read your second post ;)
  14. It's becasue of this: [code]    } else {         mysql_query("INSERT INTO news (poster, body)         VALUES ('$poster', '$body')")         or die(mysql_error());     }[/code] It's actually working fine =) try adding something like echo "It works!"; after [code]        or die(mysql_error());[/code] Hope it continues to go well :) Happy coding Benj EDIT: Actually, I may be wrong, please tell me if it doesn't work :)
  15. Are you hosting the webserver on your computer AND accessing it from a browers [i]only[/i] from that computer? Or different ones? If you're doing from the same computer, you could use the file:/// protocol, I think. If it's on a remote server, you would have to add the directory where the .pdf as an alias into the webserver config. say as /pdf/, (make sure to password protect it though :)). Then you could link to it either on Windows: file:///C:\Documents%20and%20Settings\Fred\My%20Documents\PDFs\mypdf.pdf or Linux/Unix: file:///home/fred/mypdf.pdf (I'm not to sure about the Linux one, but I think the file protocol works, I haven't used Linux in along time) or you could use say [a href=\"http://www.mydomain.com/pdf/mypdf.pdf\" target=\"_blank\"]http://www.mydomain.com/pdf/mypdf.pdf[/a] But, don't trust me completly, I haven't actually tried this before, I only thought about it in the past :P (I think about a lot of neat scripts, but never bother to make 'em :P) Anyway, good luck! Benj
  16. Hi, I'm currently trying to merge a jpeg (background image), and a png (border), that is mainly transparent, but has some parts that need 100% opacity. I've worked almost all of it out, except, when it merges, there's a "white shade" over my background. You can see what I mean here: [a href=\"http://benjrox.magazinefashion.org/img1.jpg\" target=\"_blank\"]http://benjrox.magazinefashion.org/img1.jpg[/a] As you can see, the white is there, but is it posibal to get rid of it? The code I have currently is: [code]<?php $bg_file = "/home/www/benjrox.net/myspace/images/". $_GET["img"]; $png_file = "/home/www/benjrox.net/myspace/images/bgtop.png"; $width = "1126"; $height = "562"; list($bgW, $bgH ) = getimagesize($bg_file); list($borderW, $borderH ) = getimagesize($png_file); $bgimg = ImageCreateFromJPEG($bg_file); $borderimg = ImageCreateFromPNG($png_file); ImageAlphaBlending($bgimg, true); $resized = imagecreatetruecolor( $width, $height ); imagecopyresampled( $resized, $bgimg, 0, 0, 0, 0, $width, $height, $bgW, $bgH ); ImageCopyMerge( $resized, $borderimg,  0, 0, 0, 0, $borderW, $borderH, 50); ImageJPEG($resized,FALSE,100); ImageDestroy($resized); ImageDestroy($bgimg); ImageDestroy($borderimg); ?>[/code] Thanks :) Benj
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.