Can't upload Avatar

Support for IntegraMOD 141

Moderator: Integra Moderator

Can't upload Avatar

PostAuthor: Neva » Thu Apr 24, 2008 9:07 pm

I get the following error when trying to upload an Avatar on a new install of 141f:
The avatar filetype must be .jpg, .gif or .png

I cheched that the file was a .jpg
I checked images/avatars is set to 777
I have Enable avatar uploading set to Yes


Can someone help me fix my avatar upload problem?
Last edited by Neva on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Moo
User avatar
Neva
Members
Members
 
Posts: 44
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 8:19 pm
Cash on hand: 0.00

Re: Can't upload Avatar

PostAuthor: Neva » Fri Apr 25, 2008 4:37 pm

Someone must have something I can try, I had the same problem about a year ago and someone helped me fix it, just wish I remembered what it was. :-?
Last edited by Neva on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Moo
User avatar
Neva
Members
Members
 
Posts: 44
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 8:19 pm
Cash on hand: 0.00

Re: Can't upload Avatar

PostAuthor: Neva » Sat Apr 26, 2008 11:33 am

Does anyone support this software anymore? :wink:


If anyone reads this I have a little more info.

It seems this problem also effects the uploading of photos but I can upload images into the album without a problem.

I'm running a Windows 2003 IIS server from home and have PHP 4.4.8 and MySQL 4.1.22 installed.

Please let me know if more info is needed.
Last edited by Neva on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Moo
User avatar
Neva
Members
Members
 
Posts: 44
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 8:19 pm
Cash on hand: 0.00

Re: Can't upload Avatar

PostAuthor: Neva » Sun Apr 27, 2008 10:00 am

Doing a Google search I found this page:
http://www.phpbb.com/community/viewtopi ... &sk=t&sd=a

It would seem this is a compatability issue with my IIS server.

I looked for the file needing the fixes and it does not seem to be in IM.

Can someone point me to where the code is now?
Last edited by Neva on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Moo
User avatar
Neva
Members
Members
 
Posts: 44
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 8:19 pm
Cash on hand: 0.00

Re: Can't upload Avatar

PostAuthor: Helter » Sun Apr 27, 2008 11:49 am

windows servers do not support chmod777. how did you set this? it should just be set to read/write.
Try that edit and let me know if it solves your problem.

OPEN

profilcp/functions_profile.php

FIND

[code]           switch( $type )         {             case 'jpeg']

REPLACE WITH

[code]           switch( $type )         {             case 'jpeg']
Last edited by Helter on Sun Apr 27, 2008 12:20 pm, edited 1 time in total.
"Success is getting what you want. Happiness is wanting what you get." - Dale Carnegie
User avatar
Helter
Administrator
Administrator
 
Posts: 4554
Likes: 40 posts
Liked in: 116 posts
Images: 0
Joined: Sat Mar 11, 2006 4:46 pm
Cash on hand: 1,959.15
Location: Seattle Wa
IntegraMOD version: phpBB2x

Re: Can't upload Avatar

PostAuthor: Neva » Sun Apr 27, 2008 12:06 pm

Thanks for responding. <img>

I ment the equivalent of chmod777, it is set to read/write.
Last edited by Neva on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Moo
User avatar
Neva
Members
Members
 
Posts: 44
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 8:19 pm
Cash on hand: 0.00

Re: Can't upload Avatar

PostAuthor: Neva » Sun Apr 27, 2008 12:23 pm

I tried the code change above and now get the this error:


General Error

Unable to upload file

DEBUG MODE

Line : 555
File : functions_profile.php
Last edited by Neva on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Moo
User avatar
Neva
Members
Members
 
Posts: 44
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 8:19 pm
Cash on hand: 0.00

Re: Can't upload Avatar

PostAuthor: Neva » Sun Apr 27, 2008 12:32 pm

I also found this post in a Google search that may be helpful.

http://www.phpbb2.de/ftopic26928.html
Last edited by Neva on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Moo
User avatar
Neva
Members
Members
 
Posts: 44
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 8:19 pm
Cash on hand: 0.00

Re: Can't upload Avatar

PostAuthor: Helter » Sun Apr 27, 2008 12:43 pm

go to acp/Photo Album/Configuration/GD info
does it show that your selected file types are supported?
Last edited by Helter on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
"Success is getting what you want. Happiness is wanting what you get." - Dale Carnegie
User avatar
Helter
Administrator
Administrator
 
Posts: 4554
Likes: 40 posts
Liked in: 116 posts
Images: 0
Joined: Sat Mar 11, 2006 4:46 pm
Cash on hand: 1,959.15
Location: Seattle Wa
IntegraMOD version: phpBB2x

Re: Can't upload Avatar

PostAuthor: Neva » Sun Apr 27, 2008 12:50 pm

Here is my GD info.

GD Info:
Version: bundled (2.0.28 compatible)
Freetype Fonts Support: Yes
Freetype Link Type: with freetype
T1lib Support: No
Gif Read Support: Yes
Gif Create Support: Yes
Jpg/Jpeg Support: Yes
Png Support: Yes
WBMP Support: Yes
XBM Support: Yes
Japanese Font Support: No
Last edited by Neva on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Moo
User avatar
Neva
Members
Members
 
Posts: 44
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 8:19 pm
Cash on hand: 0.00

Re: Can't upload Avatar

PostAuthor: Helter » Sun Apr 27, 2008 12:58 pm

"Neva";p="32873" wrote:I tried the code change above and now get the this error:


General Error

Unable to upload file

DEBUG MODE

Line : 555
File : functions_profile.php



looks like your trying to upload a png. check to see that this is an allowed filetype using the info in my previous post and also check acp/Extensions

be sure png is not in Forbidden Extensions and make sure in Extension Management that png is a member of the extension group images
Last edited by Helter on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
"Success is getting what you want. Happiness is wanting what you get." - Dale Carnegie
User avatar
Helter
Administrator
Administrator
 
Posts: 4554
Likes: 40 posts
Liked in: 116 posts
Images: 0
Joined: Sat Mar 11, 2006 4:46 pm
Cash on hand: 1,959.15
Location: Seattle Wa
IntegraMOD version: phpBB2x

Re: Can't upload Avatar

PostAuthor: Neva » Sun Apr 27, 2008 1:04 pm

I was trying to load a .jpg when I got the error and extensions setting look fine for .jpg, .gif and .png
Last edited by Neva on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Moo
User avatar
Neva
Members
Members
 
Posts: 44
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 8:19 pm
Cash on hand: 0.00

Re: Can't upload Avatar

PostAuthor: Helter » Sun Apr 27, 2008 1:28 pm

add the edit I posted previously, then find

Code: Select all
          case 'image/pjpeg']

after, add

[code]          case 'image/jpeg']

if that does not work, try replacing the entire file with this

[code]  <php>get('mod' . strval($userdata['user_id']), 200000, 'mod');             }             if($num_rows === FALSE)             {                 $sql = "SELECT * FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug                         WHERE ug.user_id = " . $userdata['user_id'] . "                             AND aa.group_id = ug.group_id                             AND aa.auth_mod = 1                             AND ug.user_pending = 0";                 if ( !$result = $db->sql_query($sql) )                 {                     message_die(GENERAL_ERROR, 'Could not obtain moderator status', '', __LINE__, __FILE__, $sql);                 }                 $num_rows = $db->sql_numrows($result);                 if($portal_config['cache_enabled'])                 {                     $var_cache->save($num_rows, 'mod' . strval($userdata['user_id']), 'mod');                 }             }             if ($num_rows <0>get('jadmin', 200000, 'jadmin');         }                 if($jadmin_ary === FALSE)         {             $sql = "SELECT user_id FROM " . JR_ADMIN_TABLE . "                     WHERE user_jr_admin <if>sql_query($sql) )             {                 message_die(GENERAL_ERROR, 'Could not obtain junior admin status', '', __LINE__, __FILE__, $sql);             }               while( $row = $db->sql_fetchrow($result) )             {                 $jadmin_ary[] = $row['user_id'];             }             if($db->sql_fetchrow($result) == 0)             {                 $jadmin_ary[] = -10;             }             if($portal_config['cache_enabled'])             {                 $var_cache->save($jadmin_ary, 'jadmin', 'jadmin');             }         }           $res = USER;         if ( ($row['user_level'] == ADMIN) && ($row['user_id'] == 2) || ($row['user_level'] == ADMIN) && ($row['user_id'] == 3))         {             $res = ADMIN_FOUNDER;         }         else if ($userdata['user_level'] == ADMIN)         {             $res = ADMIN;         }         else if (is_array($jadmin_ary))         {             if (in_array($userdata['user_id'], $jadmin_ary))             {                 $res = JADMIN;             }             else if ($userdata['user_level'] == MOD)             {                 $res = MOD;             }             else             {                 $res = USER;             }         }         else if ($userdata['user_level'] == MOD)         {             $res = MOD;         }         else         {             $res = USER;         }         return $res;     }       function is_admin($userdata)     {         global $admin_level;           return in_array(get_user_level($userdata),$admin_level);     }       function get_user_level_class($user_level, $default='gen', $user=array())     {         $ret = $default;         if (!empty($user)) $user_level = get_user_level($user);         switch( $user_level )         {                 case ADMIN_FOUNDER:                     $ret = 'foundercolor';                     break;                 case ADMIN:                     $ret = 'admincolor';                     break;                 case JADMIN:                     $ret = 'jadmincolor';                     break;                 case MOD:                     $ret = 'modcolor';                     break;                 default:                     $ret = 'usercolor';                     break;         }         return $ret;     }       function get_users_online_color()     {         global $lang;         global $level_prior, $level_desc;           $res = '';           // read the defined levels         @arsort($level_prior);         @reset($level_prior);         while ( list($key, $value) = @each($level_prior) )         {             if ( !empty($lang[ $level_desc[$key] ]) )             {                 $res .= ( empty($res) ? '' : '  ' ) . sprintf($lang[ $level_desc[$key] ], '[ <span>', '</span> ]');             }         }         return $res;     }       //-------------------------------------------     //     //   ranks management     //     //-------------------------------------------     function init_ranks(&$ranks)     {         global $db;           $sql = "SELECT * FROM " . RANKS_TABLE . " ORDER BY rank_special DESC, rank_min";         if ( !$result = $db->sql_query($sql) )         {             message_die(GENERAL_ERROR, 'Could not obtain ranks information.', '', __LINE__, __FILE__, $sql);         }         while ( $row = $db->sql_fetchrow($result) )         {             $ranks[] = $row;         }         $db->sql_freeresult($result);           $rank_maxi = 99999999;         for ($i=count($ranks)-1; $i >= 0; $i--)         {             if ( $row['rank_special'] ) $row['rank_mini'] = 0;             $row['rank_maxi'] = $rank_maxi;             if (!$row['rank_special'] )             {                 $rank_maxi = $row['rank_mini'];             }             else $rank_maxi = 99999999;         }     }       $all_ranks = array();     init_ranks($all_ranks);       function get_user_rank($userrow)     {         global $all_ranks;           if(empty($all_ranks)){             $all_ranks = array();             init_ranks($all_ranks);         }           $rank_title = '';         $rank_image = '';         if ($userrow['user_id'] != ANONYMOUS)         {             if ( $userrow['user_rank'] )             {                 $found = false;                 for ($i = 0; ( ($i < count($all_ranks)) && !$found); $i++)                 {                     $found = ( ($userrow['user_rank'] == $all_ranks[$i]['rank_id']) && $all_ranks[$i]['rank_special']);                     if ($found)                     {                         $ranks = explode( "|", $all_ranks[$i]['rank_title']);                         $rank_title = ( isset($ranks[$userrow['user_gender']]) && ($ranks[$userrow['user_gender']] != '') ) ? $ranks[$userrow['user_gender']] : $ranks[0];                         $rank_image = ( $all_ranks[$i]['rank_image'] ) ? '<img>' : '';                     }                 }             }             else             {                 for($i = 0; $i <count>= $all_ranks[$i]['rank_min'] && !$all_ranks[$i]['rank_special'] )                     {                         $ranks = explode( "|", $all_ranks[$i]['rank_title']);                         $rank_title = ( isset($ranks[$userrow['user_gender']]) && ($ranks[$userrow['user_gender']] != '') ) ? $ranks[$userrow['user_gender']] : $ranks[0];                         $rank_image = ( $all_ranks[$i]['rank_image'] ) ? '<img>' : '';                     }                 }             }         }           // result         $res = array();         $res['rank_title'] = $rank_title;         $res['rank_image'] = $rank_image;         return $res;     }       //-------------------------------------------     //     //   others functions     //     //-------------------------------------------     function pcp_gen_rand_string($hash)     {       $rand_str = dss_rand();       return ( $hash ) ? md5($rand_str) : substr($rand_str, 0, 8);     }       function prepare_signature( $signature, $view_userdata )     {         global $board_config, $lang;           $preview_sig = ($signature != '') ? $signature : '';         $user_sig_bbcode_uid = $view_userdata['user_sig_bbcode_uid'];           // delete html tags         if ( $preview_sig != '' && $view_userdata['user_allowhtml'] && !$board_config['allow_html'] )         {             $preview_sig = preg_replace('#(<41>)#is', "&lt;\2&gt;", $preview_sig);         }           // parse bbcodes         if ( $preview_sig != '' && $user_sig_bbcode_uid != '' && $board_config['allow_bbcode'])         {             $preview_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($preview_sig, $user_sig_bbcode_uid) : preg_replace('/:[0-9a-z:]+]/si', ']', $preview_sig);         }           // add links         if ( $preview_sig != '' ) $preview_sig = make_clickable($preview_sig);           // parse smilies         if ( $preview_sig != '' && $view_userdata['user_allowsmile'] && $board_config['allow_smilies'] )         {             $preview_sig = smilies_pass($preview_sig);         }           // formate n         if ( $preview_sig != '' ) $preview_sig = str_replace("n", "n<br>n", $preview_sig);           return $preview_sig;     }       function pcp_check_image_type(&$type, &$error, &$error_msg)     {         global $lang;           return false;     }       function pcp_user_avatar_delete($avatar_type, $avatar_file)     {         global $board_config, $userdata;           if ( $avatar_type == USER_AVATAR_UPLOAD && $avatar_file != '' )         {             if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $avatar_file)) )             {                 @unlink('./' . $board_config['avatar_path'] . '/' . $avatar_file);             }         }           return " user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE;     }       function pcp_user_avatar_gallery(&$error, &$error_msg, $avatar_filename, $avatar_category)     {         global $board_config;           if(!preg_match('/(.gif$|.png$|.jpg|.jpeg)$/is', $avatar_filename))         {             return '';         }           if ( file_exists(@phpbb_realpath($board_config['avatar_gallery_path'] . '/' . $avatar_category . '/' . $avatar_filename)) )         {             $return = " user_avatar = '" . str_replace("'", "''", $avatar_category . '/' . $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_GALLERY;         }         else         {             $return = '';         }         return $return;     }       function pcp_user_avatar_url(&$error, &$error_msg, $avatar_filename)     {         global $lang;           $width = $height = 0;           if ( !preg_match('#^(http)|(ftp)://#i', $avatar_filename) )         {             $avatar_filename = 'http://' . $avatar_filename;         }           if ( !preg_match("#^((ht|f)tp://)([^ ?&=#"nrt<]*?(.(jpg|jpeg|gif|png))$)#is", $avatar_filename) )         {             $error = true;             $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $lang['Wrong_remote_avatar_format'] : $lang['Wrong_remote_avatar_format'];             return;         }         list($width, $height, $type) = @getimagesize($tmp_filename);         if ( ($width > $board_config['avatar_max_width']) || ($height > $board_config['avatar_max_height']) )       {          $l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);            $error = true;          $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $l_avatar_size : $l_avatar_size;          return;       }         return " user_avatar = '" . str_replace("'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_REMOTE;      }  function pcp_user_avatar_upload($avatar_mode, &$current_avatar, &$current_type, &$error, &$error_msg, $avatar_filename, $avatar_realname, $avatar_filesize, $avatar_filetype){     global $board_config, $db, $lang;       $ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';       $width = $height = 0;     $type = '';       if ( $avatar_mode == 'remote' && preg_match('/^(http://)?([w-.]+):?([0-9]*)/(.*)$/', $avatar_filename, $url_ary) )     {         if ( empty($url_ary[4]) )         {             $error = true;             $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $lang['Incomplete_URL'] : $lang['Incomplete_URL'];             return;         }           $base_get = '/' . $url_ary[4];         $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80;           if ( !($fsock = @fsockopen($url_ary[2], $port, $errno, $errstr)) )         {             $error = true;             $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $lang['No_connection_URL'] : $lang['No_connection_URL'];             return;         }           @fputs($fsock, "GET $base_get HTTP/1.1rn");         @fputs($fsock, "HOST: " . $url_ary[2] . "rn");         @fputs($fsock, "Connection: closernrn");           unset($avatar_data);         while( !@feof($fsock) )         {             // Start replacement - Signatures control MOD             $avatar_data .= @fread($fsock, ( $board_config['sig_max_img_av_files_size'] ) ? $board_config['sig_max_img_av_files_size'] : $board_config['avatar_filesize']);             // End replacement - Signatures control MOD         }         @fclose($fsock);           if (!preg_match('#Content-Length: ([0-9]+)[^ /][s]+#i', $avatar_data, $file_data1) || !preg_match('#Content-Type: image/[x-]*([a-z]+)[s]+#i', $avatar_data, $file_data2))         {             $error = true;             $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $lang['File_no_data'] : $lang['File_no_data'];             return;         }           $avatar_filesize = $file_data1[1];         $avatar_filetype = $file_data2[1];           if ( ($avatar_filesize > 0 && $avatar_filesize < $board_config['avatar_filesize']) || $board_config['sig_max_img_av_files_size'] )         {             $avatar_data = substr($avatar_data, strlen($avatar_data) - $avatar_filesize, $avatar_filesize);               $tmp_path = ( !@$ini_val('safe_mode') ) ? '/tmp' : './' . $board_config['avatar_path'] . '/tmp';             $tmp_filename = tempnam($tmp_path, uniqid(rand()) . '-');               $fptr = @fopen($tmp_filename, 'wb');             $bytes_written = @fwrite($fptr, $avatar_data, $avatar_filesize);             @fclose($fptr);               if ( $bytes_written != $avatar_filesize )             {                 @unlink($tmp_filename);                 message_die(GENERAL_ERROR, 'Could not write avatar file to local storage. Please contact the board administrator with this message', '', __LINE__, __FILE__);             }               list($width, $height, $type) = @getimagesize($tmp_filename);         }         else         {             $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));               $error = true;             $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $l_avatar_size : $l_avatar_size;         }     }     else if ( ( file_exists(@phpbb_realpath($avatar_filename)) ) && preg_match('/.(jpg|jpeg|gif|png)$/i', $avatar_realname) )     {         if ( $avatar_filesize <board_config> 0) || $board_config['sig_max_img_av_files_size'])         {             preg_match('#image/[x-]*([a-z]+)#', $avatar_filetype, $avatar_filetype);             $avatar_filetype = $avatar_filetype[1];         }         else         {             $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));               $error = true;             $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $l_avatar_size : $l_avatar_size;             return;         }           list($width, $height, $type) = @getimagesize($avatar_filename);     }  if ( !preg_match("/(gif|jpg|jpeg|png)/i", trim(array_pop(explode("/", array_pop(getimagesize($avatar_filename))))), $imgtype) )         {    $error = true;    $error_msg = (!empty($error_msg)) ? $error_msg . '<br>' . $lang['Avatar_filetype'] : $lang['Avatar_filetype'];    return;    }    $imgtype = '.'.$imgtype[1];       switch ($type)     {         // GIF         case 1:             if ($imgtype != '.gif')             {                 @unlink($tmp_filename);                 message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);             }         break;           // JPG, JPC, JP2, JPX, JB2         case 2:         case 9:         case 10:         case 11:         case 12:             if ($imgtype != '.jpg' && $imgtype != '.jpeg')             {                 @unlink($tmp_filename);                 message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);             }         break;           // PNG         case 3:             if ($imgtype != '.png')             {                 @unlink($tmp_filename);                 message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);             }         break;           default:             @unlink($tmp_filename);             message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);     }       if ( $width > 0 && $height > 0 && $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] )     {         $new_filename = uniqid(rand()) . $imgtype;           if ( $current_type == USER_AVATAR_UPLOAD && $current_avatar != '' )         {             pcp_user_avatar_delete($current_type, $current_avatar);         }           if( $avatar_mode == 'remote' )         {             @copy($tmp_filename, './' . $board_config['avatar_path'] . "/$new_filename");             @unlink($tmp_filename);         }         else         {             if ( @$ini_val('open_basedir') != '' )             {                 if ( @phpversion() < '4.0.3' )                 {                     message_die(GENERAL_ERROR, 'open_basedir is set and your PHP version does not allow move_uploaded_file', '', __LINE__, __FILE__);                 }                   $move_file = 'move_uploaded_file';             }             else             {                 $move_file = 'copy';             }               $move_file($avatar_filename, './' . $board_config['avatar_path'] . "/$new_filename");         }           @chmod('./' . $board_config['avatar_path'] . "/$new_filename", 0777);           $avatar_sql = " user_avatar = '$new_filename', user_avatar_type = " . USER_AVATAR_UPLOAD;     }     else     {         $l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);           $error = true;         $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $l_avatar_size : $l_avatar_size;     }       return $avatar_sql;}     function create_birthday_date($format, $date, $timezone)     {         global $board_config, $lang;         static $translate;           $birthday = '';         if (intval($date) != 0)         {             // create a date on year 1971             $day = intval(substr($date, 6, 2));             $month = intval(substr($date, 4, 2));             $year = substr($date, 0, 4);             $temp_date = date($format, mktime( 0, 0, 1, $month, $day, 1971));             $birthday = str_replace( '1971', $year, $temp_date );             if ( empty($translate) && $board_config['default_lang'] != 'english' )             {                 @reset($lang['datetime']);                 while ( list($match, $replace) = @each($lang['datetime']) )                 {                     $translate[$match] = $replace;                 }             }             if (!empty($translate))             {                 $birthday = strtr($birthday, $translate);             }         }         return $birthday;     }  function pcp_user_photo_delete($photo_type, $photo_file){     global $board_config, $userdata;       if ( $photo_type == USER_AVATAR_UPLOAD && $photo_file != '' )     {         if ( @file_exists(@phpbb_realpath('./' . $board_config['photo_path'] . '/' . $photo_file)) )         {             @unlink('./' . $board_config['photo_path'] . '/' . $photo_file);         }     }       return " user_photo = '', user_photo_type = " . USER_AVATAR_NONE;}  function pcp_user_photo_gallery(&$error, &$error_msg, $photo_filename){     global $board_config;     if ( file_exists(@phpbb_realpath($board_config['photo_gallery_path'] . '/' . $photo_filename)) )     {         $return = " user_photo = '" . str_replace("'", "''", $photo_filename) . "', user_photo_type = " . USER_AVATAR_GALLERY;     }     else     {         $return = '';     }     return $return;}  function pcp_user_photo_url(&$error, &$error_msg, $photo_filename){     global $board_config, $lang;       if ( !preg_match('#^(http)|(ftp)://#i', $photo_filename) )     {         $photo_filename = 'http://' . $photo_filename;     }       if ( !preg_match('#^((http)|(ftp)://[w-]+?.([w-]+.)+[w]+(:[0-9]+)*/.*?.(gif|jpg|jpeg|png)$)#is', $photo_filename) )     {         $error = true;         $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $lang['Wrong_remote_photo_format'] : $lang['Wrong_remote_photo_format'];         return;     }     list($width, $height) = @getimagesize($photo_filename);         if ( ($width > $board_config['photo_max_width']) || ($height > $board_config['photo_max_height']) )     {         $l_photo_size = sprintf($lang['Photo_imagesize'], $board_config['photo_max_width'], $board_config['photo_max_height']);           $error = true;         $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $l_photo_size : $l_photo_size;         return;     }     return " user_photo = '" . str_replace("'", "''", $photo_filename) . "', user_photo_type = " . USER_AVATAR_REMOTE;  }  function pcp_user_photo_upload($photo_mode, &$current_photo, &$current_type, &$error, &$error_msg, $photo_filename, $photo_realname, $photo_filesize, $photo_filetype){     global $board_config, $db, $lang;       $ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';       if ( $photo_mode == 'remote' && preg_match('/^(http://)?([w-.]+):?([0-9]*)/(.*)$/', $photo_filename, $url_ary) )     {         if ( empty($url_ary[4]) )         {             $error = true;             $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $lang['Incomplete_URL'] : $lang['Incomplete_URL'];             return;         }           $base_get = '/' . $url_ary[4];         $port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80;           if ( !($fsock = @fsockopen($url_ary[2], $port, $errno, $errstr)) )         {             $error = true;             $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $lang['No_connection_URL'] : $lang['No_connection_URL'];             return;         }           @fputs($fsock, "GET $base_get HTTP/1.1rn");         @fputs($fsock, "HOST: " . $url_ary[2] . "rn");         @fputs($fsock, "Connection: closernrn");           unset($photo_data);         while( !@feof($fsock) )         {             $photo_data .= @fread($fsock, $board_config['photo_filesize']);         }         @fclose($fsock);           if (!preg_match('#Content-Length: ([0-9]+)[^ /][s]+#i', $photo_data, $file_data1) || !preg_match('#Content-Type: image/[x-]*([a-z]+)[s]+#i', $photo_data, $file_data2))         {             $error = true;             $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $lang['File_no_data'] : $lang['File_no_data'];             return;         }           $photo_filesize = $file_data1[1];         $photo_filetype = $file_data2[1];           if ( !$error && $photo_filesize > 0 && $photo_filesize < $board_config['photo_filesize'] )         {             $photo_data = substr($photo_data, strlen($photo_data) - $photo_filesize, $photo_filesize);               $tmp_path = ( !@$ini_val('safe_mode') ) ? '/tmp' : './' . $board_config['photo_path'] . '/tmp';             $tmp_filename = tempnam($tmp_path, uniqid(rand()) . '-');               $fptr = @fopen($tmp_filename, 'wb');             $bytes_written = @fwrite($fptr, $photo_data, $photo_filesize);             @fclose($fptr);               if ( $bytes_written != $photo_filesize )             {                 @unlink($tmp_filename);                 message_die(GENERAL_ERROR, 'Could not write photo file to local storage. Please contact the board administrator with this message', '', __LINE__, __FILE__);             }               list($width, $height) = @getimagesize($tmp_filename);         }         else         {             $l_photo_size = sprintf($lang['Photo_filesize'], round($board_config['photo_filesize'] / 1024));               $error = true;             $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $l_photo_size : $l_photo_size;         }     }     else if ( ( file_exists(@phpbb_realpath($photo_filename)) ) && preg_match('/.(jpg|jpeg|gif|png)$/i', $photo_realname) )     {         if ( $photo_filesize <board_config> 0 )         {             preg_match('#image/[x-]*([a-z]+)#', $photo_filetype, $photo_filetype);             $photo_filetype = $photo_filetype[1];         }         else         {             $l_photo_size = sprintf($lang['Photo_filesize'], round($board_config['photo_filesize'] / 1024));               $error = true;             $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $l_photo_size : $l_photo_size;             return;         }           list($width, $height) = @getimagesize($photo_filename);     }       if ( !($imgtype = pcp_check_image_type($photo_filetype, $error, $error_msg)) )     {         return;     }       if ( $width > 0 && $height > 0 )     {         $new_filename = uniqid(rand()) . $imgtype;           if ( $current_type == USER_AVATAR_UPLOAD && $current_photo != '' )         {             if ( file_exists(@phpbb_realpath('./' . $board_config['photo_path'] . '/' . $current_photo)) )             {                 @unlink('./' . $board_config['photo_path'] . '/' . $current_photo);             }         }           if( $photo_mode == 'remote' )         {             @copy($tmp_filename, './' . $board_config['photo_path'] . "/$new_filename");             @unlink($tmp_filename);         }         else         {             if ( @$ini_val('open_basedir') != '' )             {                 if ( @phpversion() < '4.0.3' )                 {                     message_die(GENERAL_ERROR, 'open_basedir is set and your PHP version does not allow move_uploaded_file', '', __LINE__, __FILE__);                 }                   $move_file = 'move_uploaded_file';             }             else             {                 $move_file = 'copy';             }               $move_file($photo_filename, './' . $board_config['photo_path'] . "/$new_filename");         }           @chmod('./' . $board_config['photo_path'] . "/$new_filename", 0777);           if ($width > $board_config['photo_max_width'] || $height > $board_config['photo_max_height'])         {             $width_old = $width;             $height_old = $height;             if ($width > $board_config['photo_max_width'])             {                 $height = ($board_config['photo_max_width'] / $width) * $height;                 $width = $board_config['photo_max_width'];             }             if ($height > $board_config['photo_max_height'])             {                 $width = ($board_config['photo_max_height'] / $height) * $width;                 $height = $board_config['photo_max_height'];             }             $width = round ($width);   // to avoid float->integer conversion problems             $height = round ($height); // to avoid float->integer conversion problems             switch ($imgtype)             {                 case '.jpg':                     $imagecreatefrom_function = imagecreatefromjpeg;                     $image_function = imagejpeg;                     break;                 case '.gif':                     $imagecreatefrom_function = imagecreatefromgif;                     $image_function = imagegif;                     break;                 case '.png':                     $imagecreatefrom_function = imagecreatefrompng;                     $image_function = imagepng;                     break;             }             $img_old = $imagecreatefrom_function ('./' . $board_config['photo_path'] . "/$new_filename");             $img_new = imagecreatetruecolor ($width, $height);             imagecopyresampled ($img_new, $img_old, 0, 0, 0, 0, $width, $height, $width_old, $height_old);             $image_function ($img_new, './' . $board_config['photo_path'] . "/$new_filename");             imagedestroy ($img_new);         }         $photo_sql = " user_photo = '$new_filename', user_photo_type = " . USER_AVATAR_UPLOAD;     }     else     {         $l_photo_size = sprintf($lang['Photo_imagesize'], $board_config['photo_max_width'], $board_config['photo_max_height']);           $error = true;         $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br>' . $l_photo_size : $l_photo_size;     }       return $photo_sql;}       //-------------------------------------------     //     //   fields definitions     //     //-------------------------------------------     if ( !defined('DEF_INCLUSION_DONE') )     {         $dir = @opendir($phpbb_root_path . './profilcp/def');         while( $file = @readdir($dir) )         {             if( preg_match("/^def_.*?." . $phpEx . "$/", $file) )             {                 include_once($phpbb_root_path . './profilcp/def/' . $file);             }         }         @closedir($dir);         define('DEF_INCLUSION_DONE', true);     }       //-------------------------------------------     //     //   menu service function     //     //-------------------------------------------     function pcp_set_menu($mode, $sort='', $url='', $shortcut='', $page_title='')     {         global $lang;         global $module;         global $user_maps;           // get the menu idx         $idx = count($module['mode']);         $new = false;         $found = false;         for ( $i = 0; $i < count($module['mode']); $i++ )         {             $found = ( $module['mode'][$i] == $mode );             if ( $found )             {                 $idx = $i;                 break;             }         }           // init         if ( !$found )         {             $module['sort'][$idx]             = '';             $module['url'][$idx]             = '';             $module['shortcut'][$idx]         = '';             $module['page_title'][$idx]       = '';             $module['sub'][$idx]             = array();         }           // add it         $module['mode'][$idx]             = $mode;         $module['sort'][$idx]             = empty($module['sort'][$idx]) ? $sort : $module['sort'][$idx];         $module['url'][$idx]             = empty($module['url'][$idx]) ? basename($url) : $module['url'][$idx];         $module['shortcut'][$idx]         = empty($module['shortcut'][$idx]) ? $lang[$shortcut] : $module['shortcut'][$idx];         $module['page_title'][$idx]       = empty($module['page_title'][$idx]) ? $lang[$page_title] : $module['page_title'][$idx];           if ( isset($user_maps['PCP.' . $mode]) )         {             $module['sort'][$idx] = $user_maps['PCP.' . $mode]['order'];         }           return $idx;     }       function pcp_set_sub_menu($mode, $sub_mode, $sub_sort='', $sub_url='', $sub_shortcut='', $sub_page_title='' )     {         global $lang;         global $module;         global $user_maps;           // ensure the main menu exists         $idx = pcp_set_menu($mode);           // check if the sub_menu exists         $sub_idx = count($module['sub'][$idx]['mode']);         $found = false;         for ( $i = 0; $i </b>  
Last edited by Helter on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
"Success is getting what you want. Happiness is wanting what you get." - Dale Carnegie
User avatar
Helter
Administrator
Administrator
 
Posts: 4554
Likes: 40 posts
Liked in: 116 posts
Images: 0
Joined: Sat Mar 11, 2006 4:46 pm
Cash on hand: 1,959.15
Location: Seattle Wa
IntegraMOD version: phpBB2x

Re: Can't upload Avatar

PostAuthor: Neva » Sun Apr 27, 2008 1:54 pm

Tried adding the one line of code and got:

General Error

Unable to upload file

DEBUG MODE

Line : 556
File : functions_profile.php




Tried the new file and get:

General Error

Unable to upload file

DEBUG MODE

Line : 536
File : functions_profile.php



This seems to be the line of code that breaks it.
Code: Select all
          message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
Last edited by Neva on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Moo
User avatar
Neva
Members
Members
 
Posts: 44
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 8:19 pm
Cash on hand: 0.00

Re: Can't upload Avatar

PostAuthor: Helter » Sun Apr 27, 2008 2:31 pm

that is not the line that breaks it, that is the line that reports that it is broken. All of the edites ive posted work fine on my server. I think the trouble may be in your IIS or php setup. Have you tried using apache instead of IIS? I dont know enough about IIS to be of any real assistance with it
Last edited by Helter on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
"Success is getting what you want. Happiness is wanting what you get." - Dale Carnegie
User avatar
Helter
Administrator
Administrator
 
Posts: 4554
Likes: 40 posts
Liked in: 116 posts
Images: 0
Joined: Sat Mar 11, 2006 4:46 pm
Cash on hand: 1,959.15
Location: Seattle Wa
IntegraMOD version: phpBB2x

Re: Can't upload Avatar

PostAuthor: Neva » Sun Apr 27, 2008 6:28 pm

I got the avatar upload working but still no luck with the profile photo. <img>

I get this error when uploading a photo:
The photo must be less than 800 pixels wide and 600 pixels high
Last edited by Neva on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Moo
User avatar
Neva
Members
Members
 
Posts: 44
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 8:19 pm
Cash on hand: 0.00

Re: Can't upload Avatar

PostAuthor: Helter » Sun Apr 27, 2008 9:42 pm

acp/General Admin/Configuration/ Photo Settings
Last edited by Helter on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
"Success is getting what you want. Happiness is wanting what you get." - Dale Carnegie
User avatar
Helter
Administrator
Administrator
 
Posts: 4554
Likes: 40 posts
Liked in: 116 posts
Images: 0
Joined: Sat Mar 11, 2006 4:46 pm
Cash on hand: 1,959.15
Location: Seattle Wa
IntegraMOD version: phpBB2x

Re: Can't upload Avatar

PostAuthor: Neva » Mon Apr 28, 2008 5:04 am

I wish it was that easy, I was trying to use a 80x80 image when I got that error.

Yay for IIS servers. <img>
Last edited by Neva on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Moo
User avatar
Neva
Members
Members
 
Posts: 44
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 8:19 pm
Cash on hand: 0.00

Re: Can't upload Avatar

PostAuthor: Helter » Mon Apr 28, 2008 5:09 pm

not sure why it would trigger the wrong error, but check that your allowed image size is adequate in kilobytes (kb)
Last edited by Helter on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
"Success is getting what you want. Happiness is wanting what you get." - Dale Carnegie
User avatar
Helter
Administrator
Administrator
 
Posts: 4554
Likes: 40 posts
Liked in: 116 posts
Images: 0
Joined: Sat Mar 11, 2006 4:46 pm
Cash on hand: 1,959.15
Location: Seattle Wa
IntegraMOD version: phpBB2x

Re: Can't upload Avatar

PostAuthor: Neva » Mon Apr 28, 2008 5:14 pm

The setting seem fine.
I was having the same problem with the avatar upload but I found a work around in one of the links I posted above, just don't know how to apply the fix to the photo part.
Last edited by Neva on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Moo
User avatar
Neva
Members
Members
 
Posts: 44
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 8:19 pm
Cash on hand: 0.00


Return to IntegraMOD 141

Who is online

Registered users: App360MonitorBot, Bing [Bot], Google [Bot]