Jump to content

13th_Star

Members
  • Posts

    33
  • Joined

  • Last visited

    Never

About 13th_Star

  • Birthday 12/09/1988

Contact Methods

  • MSN
    billy@rocklifes.com
  • Website URL
    http://www.rocklifes.com

Profile Information

  • Gender
    Male
  • Location
    Telford, UK

13th_Star's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey I worked out the crop image this topic is done with
  2. Hey that worked great on the ResizeImage() Function, its just the CropImage() I'm still stuck with now.
  3. Ah yes I have not gotten round to doing all of the checks and so on yet, I may be putting sessions in or I may just stick to using httponly cookies. thanks
  4. I have recently made two functions one to resize an image and one to crop it, only some times when I try to upload photos at a certain size lets say 800x600px, it gives me some errors and just shows the pictures as plain black, I can't really work out whats up with it so if someone does not mind could they take a look at my functions. thanks. the errors: Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/bpotts/public_html/image_functions.php on line 90 Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/bpotts/public_html/image_functions.php on line 48 the functions: ( i have marked what line 48 and 90 are) <?php //Image functions// Crop, Reisize. function ResizeImage($nw, $nh, $source, $stype, $dest) { $size = getimagesize($source); $w = $size[0]; $h = $size[1]; switch($stype) { case 'gif': $simg = imagecreatefromgif($source); break; case 'jpg': $simg = imagecreatefromjpeg($source); break; case 'jpeg': $simg = imagecreatefromjpeg($source); break; case 'png': $simg = imagecreatefrompng($source); break; } if ($w > $nw) { $n_h = $h * ($nw/$w); $n_w = ($n_h / $h) * $w; } else if ($w < $nw && $h > $nh) { $n_h = $w * ($nh/$h); $n_w = ($n_w / $w) * $h; } else { $n_h = $h; $n_w = $w; } $dimg = imagecreatetruecolor($n_w, $n_h); imagecopyresampled($dimg,$simg,-0,0,0,0,$n_w,$n_h,$w,$h); imagejpeg($dimg,$dest, "100"); } //this is line 48! function CropImage($nw, $nh, $source, $stype, $dest) { $size = getimagesize($source); $w = $size[0]; $h = $size[1]; switch($stype) { case 'gif': $simg = imagecreatefromgif($source); break; case 'jpg': $simg = imagecreatefromjpeg($source); break; case 'jpeg': $simg = imagecreatefromjpeg($source); break; case 'png': $simg = imagecreatefrompng($source); break; } $dimg = imagecreatetruecolor($nw, $nh); $wm = $w/$nw; $hm = $h/$nh; $h_height = $nh/2; $w_height = $nw/2; if($w > $h) { $adjusted_width = $w / $hm; $half_width = $adjusted_width / 2; $int_width = $half_width - $w_height; imagecopyresampled($dimg,$simg,-$int_width,0,0,0,$adjusted_width,$nh,$w,$h); } elseif(($w < $h) || ($w == $h)) { $adjusted_height = $h / $wm; $half_height = $adjusted_height / 2; $int_height = $half_height - $h_height; //THIS IS LINE 91 imagecopyresampled($dimg,$simg,0,-$int_height,0,0,$nw,$adjusted_height,$w,$h); } else { imagecopyresampled($dimg,$simg,0,0,0,0,$nw,$nh,$w,$h); } imagejpeg($dimg,$dest, "100"); } ?>
  5. ah i see I thought he ment a link on the forums script cus it said ?username=0 on the end and dont know where that came from. anyways, Just added a mail system
  6. ok so you've got $songname = aa's and your error is: 'aa's' it just looks like it does not like the extra ' in the middle. which you should just take out with the $songname = str_replace("'","",$songname); like you did with the filename
  7. change this $fname = str_replace(' ', '', $fname); back to $fname = str_replace("'", "", $fname);
  8. That doesn't make sense. If test is going to be an array, check the count(); if(count($test)){ } well everytime I try to use if($blabla) it does fuck all lol
  9. try this then: $songname2 = str_replace("'", "", $songname); $songname2 = str_replace("\\", "", $songname2);
  10. Hey not a problem you should stop using PHP Triad (what ever it is lol, i havent a clue!) and try using xampp
  11. the code looks fine to me, are you trying to change the page within a certain div on youe page or the hole page all together? if yes then wha tyou need is javascript. if not and your getting ablank page try this: <?php $location = $_GET['location']; switch ($location){ case "home": include "home.php"; break; case "services": include "services.php"; break; default: include "home.php"; break; } ?>
  12. Hey I forgot to block html in the poll's need to process votes just to let people know I will get on that soon. oh and where did you find that dead link? would help alot thanks.
  13. ah yes I just noticed the thing with the pagins and I'm gonna get it sorted. also I have not got around to blocking viewers from writting in messages yet, But it sure is on my list. oh and atm I'm currently working on the profile pages, gonna try keep them neet and easy to use. they should be on some time soon, unless I fall asleep the best thing about this topic I can come read it and it reminds me what I need to do lol.
×
×
  • 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.