lpxxfaintxx Posted November 30, 2008 Share Posted November 30, 2008 profilepic.php $sessid = $_SESSION['id']; $user = queryuser($sessid); if ($user[profilepic] == "") { $imgurl = "images/nophoto.jpg"; } else { $imgurl = $user[profilepic]; } if(isset($_FILES['upload'])){ if(preg_match('/[.](jpg)|(gif)|(png)$/', $_FILES['upload']['name'])){ $filename = $_FILES['upload']['name']; $ext = pathinfo($filename, PATHINFO_EXTENSION); $filename2 = $user[user_id]; $source = $_FILES['upload']['tmp_name']; $target = $path_to_image_directory . $filename2 .'.'.$ext; move_uploaded_file($source, $target); createThumbnail($filename2,$ext); } functions.php function createThumbnail($filename2,$ext) { require 'config.php'; if(preg_match('/[.](jpg)$/', $filename2 .'.'.$ext)) { $im = imagecreatefromjpeg($path_to_image_directory . $filename2 .'.'.$ext); } else if (preg_match('/[.](gif)$/', $filename2 .'.'.$ext)) { $im = imagecreatefromgif($path_to_image_directory . $filename2 .'.'.$ext); } else if (preg_match('/[.](png)$/', $filename2 .'.'.$ext)) { $im = imagecreatefrompng($path_to_image_directory . $filename2 .'.'.$ext); } $ox = imagesx($im); $oy = imagesy($im); if($ox > 300){ $nx = $final_width_of_image; $ny = floor($oy * ($final_width_of_image / $ox)); $nm = imagecreatetruecolor($nx, $ny); imagecopyresized($nm, $im, 0,0,0,0,$nx,$ny,$ox,$oy); if(!file_exists($path_to_thumbs_directory)) { if(!mkdir($path_to_thumbs_directory)) { die("There was a problem. Please try again!"); } } imagejpeg($nm, $path_to_thumbs_directory . $filename2 .'.'.$ext); $tn = '<img src="' . $path_to_thumbs_directory . $filename2 .'.'.$ext . '" alt="image" />'; $tn .= '<br />Congratulations. Your file has been successfully uploaded, and a thumbnail has been created.'; echo $tn; } else { } Error: Warning: Missing argument 2 for createThumbnail(), called in /home/q94/public_html/alumnify.com/profilepic.php on line 30 and defined in /home/q94/public_html/alumnify.com/includes/classes.php on line 19 Any idea what I did wrong? Link to comment https://forums.phpfreaks.com/topic/134894-functions-help-needed-again/ Share on other sites More sharing options...
genericnumber1 Posted November 30, 2008 Share Posted November 30, 2008 Try adding error_reporting(E_ALL); to the top of the script. Link to comment https://forums.phpfreaks.com/topic/134894-functions-help-needed-again/#findComment-702455 Share on other sites More sharing options...
DarkWater Posted November 30, 2008 Share Posted November 30, 2008 @genericnumber: He already has errors showing. o_O EDIT: Try doing a print_r() on pathinfo($filename); Link to comment https://forums.phpfreaks.com/topic/134894-functions-help-needed-again/#findComment-702457 Share on other sites More sharing options...
genericnumber1 Posted November 30, 2008 Share Posted November 30, 2008 Yeah, he has a second param set, so there might be another error we can't see.. Just a hunch. If you don't get anything, try echoing $ext and $filename2 before you use them to see if they are what you expect... if not, trace them back and find why. Link to comment https://forums.phpfreaks.com/topic/134894-functions-help-needed-again/#findComment-702462 Share on other sites More sharing options...
lpxxfaintxx Posted November 30, 2008 Author Share Posted November 30, 2008 Wow, sorry for the troubles guys. I found my problem, and it's quite an embarrassing one. I only re-uploaded functions.php and not profilepic.php. Link to comment https://forums.phpfreaks.com/topic/134894-functions-help-needed-again/#findComment-702482 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.