Jump to content

tippy_102

Members
  • Posts

    446
  • Joined

  • Last visited

    Never

Everything posted by tippy_102

  1. Here is the information on using constants: http://ca.php.net/constants
  2. Do the members have to be logged in to upload a file? If so keep their member id in a session and retrieve it for the file name.
  3. You could use if statements, or something like this... switch ( $p[4] ) { case 'UK' : ....do whatever... break; case 'Canada' : ....do whatever... break; default : ...catch all for countries you haven't accounted for... break; }
  4. This is beyond my abilities (or lack thereof), so hopefully someone else will jump in and show us how to attack this problem.
  5. Have you looked at fpdf? http://www.fpdf.org/
  6. Search for "php watermark" in google and you'll see that it definitely is possible.
  7. You need to show is the part that contains the mysql_query.
  8. That looks very nice but why use tables for layout? CSS is much more versatile.
  9. The top 2 look very nice but they load quite slowly. Also, you used tables - all the cool kids are using CSS for layout now. The HABIB DECOR site doesn't match the quality of the others, and the perspective is not correct with the nav bar items between the columns.
  10. You will have to change your form and your mysql_query so it searches the multiple values. If you post some code it might be easier to explain.
  11. If you want to do it yourself, have a look at php's SimpleXML functions: http://ca.php.net/manual/en/ref.simplexml.php or grab a copy of SimplePie (http://simplepie.org/) and you'll be reading feeds within a few minutes.
  12. Check that your path is correct for getimagesize - $dimensions = getimagesize("http://www.x.com/uploads/charlie.gif"); If you're using a gif file, you have to use imagecreatefromgif
  13. If you want to display the file instead of saving it.... header("Content-type: image/png"); imagepng($canvas);
  14. Unless I'm overlooking something, you haven't told INSERT which columns to insert into.
  15. This should get you started.... <?php header('content-type: image/jpeg'); $original_image = "image.jpg"; $watermark = imagecreatefrompng('watermark.png'); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $image = imagecreatetruecolor($watermark_width, $watermark_height); $image = imagecreatefromjpeg($original_image); $size = getimagesize($original_image); $dest_x = $size[0] - $watermark_width - 5; $dest_y = $size[1] - $watermark_height - 5; imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); imagejpeg($image); imagedestroy($image); imagedestroy($watermark); ?>
  16. function FriendlyDate($SqDate) { list($Year,$Month,$Day) = split('-',$SqDate); //Remove the '-' from the standard MySQL date format //check to see if year is NULL or 0000 if so, lets not print anything if (($Year == "0000") or ($Year == NULL)) { $realDate = ""; } ELSE { $stampeddate = mktime(12,0,0,$Month,$Day,$Year); //Create a UNIX style timestamp from the result $realDate = date("M d, Y",$stampeddate); //Format the UNIX timestamp } $realDate = str_replace (" ", " ", $realDate); return $realDate; }
  17. Someone solved this a few days ago. Perhaps their solution will help you: http://www.phpfreaks.com/forums/index.php/topic,190882.0.html
  18. Hard to say without seeing your entire code, but here's what I use: <?php // creates a copy of a selected chunk of image.jpg $filename= "image.jpg"; list($w, $h, $type, $attr) = getimagesize($filename); $src_im = imagecreatefromjpeg($filename); $src_x = '0'; // begin x $src_y = '0'; // begin y $src_w = '100'; // width $src_h = '100'; // height $dst_x = '0'; // destination x $dst_y = '0'; // destination y $dst_im = imagecreatetruecolor($src_w, $src_h); $white = imagecolorallocate($dst_im, 255, 255, 255); imagefill($dst_im, 0, 0, $white); imagecopy($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h); header("Content-type: image/png"); imagepng($dst_im); imagedestroy($dst_im); ?>
  19. Try this: <?php $text = "Center This Text!"; $image = "image.jpg"; $font = "arial.ttf"; $font_size = "25"; $image_2 = imagecreatefromjpeg($image); $black = imagecolorallocate($image_2,0,0,0); $image_width = imagesx($image_2); $image_height = imagesy($image_2); $text_box = imagettfbbox($font_size,$angle,$font,$text); $text_width = $text_box[2]-$text_box[0]; // lower right corner - lower left corner $text_height = $text_box[3]-$text_box[1]; $x = ($image_width/2) - ($text_width/2); $y = ($image_height/2) - ($text_height/2); imagettftext($image_2,$font_size,0,$x,$y,$black,$font,$text ); header ("Content-type: image/png"); imagejpeg($image_2); ?>
  20. Red text on medium grey is never a good idea, and the blue link on grey is really hard to see. I really like the header.
  21. Maybe it's my monitor, but that black text on light blue is hard on the eyes.
  22. I had this little snippet tucked away. It should help you. <?php $path = "gal"; echo "Folder $path = ".filesize_r($path)." bytes"; function filesize_r($path){ if(!file_exists($path)) return 0; if(is_file($path)) return filesize($path); $ret = 0; foreach(glob($path."/*") as $fn) $ret += filesize_r($fn); return $ret; } ?>
  23. Download the installer - it's the easiest set-up. They have forums as well: http://www.apachefriends.org/f/
  24. I use xampp with windows. You can download xampp from: http://www.apachefriends.org/en/xampp.html It contains an installer so it is a simple process.
  25. Unless you are doing this project for the learning experience, there is no sense re-inventing the wheel, so I'd say use existing code to speed up production.
×
×
  • 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.