Snippet from http://ivarjohnson.com ZERO support offered! Enter at your own risk. OH! UPDATE: Can't remember now what version of pMachine this was for!! If things look off... don't proceed!! 1. Open the pMachine file 'memberhandler.php' found in the 'pm/lib/' folder. 2. Make a backup copy of this file now, in case anything goes wrong. 3. The first line of code after the opening comments says "if (isset($HTTP_GET_VARS...". Paste the following three lines just above this (about line 19 or 20). Be sure to edit the path to match your setup: $images_dir = '/home/your_path_to_thumbnail_images/images/profilepics/thumbs/'; $dw = 1; $dh = 1; 4. Scroll down to about line number 195 or further, you should see "case "register" : // MEMBER REGISTRATION". Just below that line, paste this: $signature = $username; 5. Scroll down a little further (about line 232, though this is now an estimated line number) look for where in this same section under MEMBER REGISTRATION the line begins "$mbr_array = array();". Right above this line, paste the following: handleImage($HTTP_POST_FILES['img1']); 6. Near the bottom of the page, right before the closing '?>', and after the 'break; }', paste this code (thanks to Charles Verge in Nova Scotia for this!): function handleImage($img1){ global $images_dir; global $dw; global $dh; global $signature; $img1['type'] = preg_split('/\//',$img1['type']); if('image' == $img1['type'][0]){ $itype = strtolower($img1['type'][1]); if($img1['size']>0){ if($itype == 'png') $simage = imagecreatefrompng($img1['tmp_name']); elseif($itype == 'jpeg' or $itype == 'jpg') $simage = imagecreatefromjpeg($img1['tmp_name']); else $simage = imagecreatefromjpeg($img1['tmp_name']); $dimage = imagecreatetruecolor($dw,$dh); imagecopyresampled($dimage, $simage, 0,0, 0,0, $dw,$dh, imagesx($simage), imagesy($simage)); imagedestroy($simage); imagepng($dimage,$images_dir.$signature.'.jpg'); imagedestroy($dimage); } } else{ if(!is_file($images_dir.$signature.'.jpg')) copy($images_dir.'_blank.jpg', $images_dir.$signature.'.jpg'); } } 7. Save the page and upload it to the correct directory. 8. Open the "Bill's Image-Uploader & Resizer 3.1" zip file and follow directions contained within it to get that script working on your site. Maintain the original directory structure when you set it up for ease. Upload everything, folders and all, from the 'script' folder to the folder you specified in Step 3., just above the 'thumbs' directory. If you followed my example, this would be the 'profilepics' folder. In my installation of this hack, I disconnected the stylesheet that accompanies the download. Also, I commented out the lines of code that display the uploaded image and thumbnail. To find these, open 'upnresize.php', do a search for all the lines that start out 'echo'. The lines to comment out are 124, 139, 210, 250, and 259. 9. Log into your Admin area of pMachine to edit the Membership Templates. Go to 'Edit Templates', then click 'Edit' for 'membership'. 10. Go to 'Registration Form'. 11. Find this code: 12. Replace that code with: 13. Click 'UPDATE'. 14. Go to Edit membership again and click "Profile Form (private)". 15. Find this chunk of code:
Image UploadPlease use this sectionseparately from the rest of this form. Browse for your image and click upload to add an image to your Profile. |