1
v12kid
Avatar bulk load?
  • 2005/5/9 6:30

  • v12kid

  • Just popping in

  • Posts: 4

  • Since: 2005/4/7 2


Is it possible to load many avatars at the same time instead of having to load them individually? I have many to load and it seems like there has to be an easier way to load them.

thanks

matt

2
jdseymour
Re: Avatar bulk load?

See this downloadable tutorial Here on the Docs site.

HTH.

3
xoopdio
Re: Avatar bulk load?
  • 2011/9/28 7:25

  • xoopdio

  • Just popping in

  • Posts: 29

  • Since: 2011/9/27


Hi

I know it is an old post but the link is dead as well as this one : https://xoops.org/modules/smartfaq/faq.php?faqid=260 given on this page : https://xoops.org/modules/smartfaq/faq.php?faqid=417

Please do you know where I can find a tutorial to load a bulk of avatars ?

Thank you

4
hipoonios
Re: Avatar bulk load?
  • 2011/9/28 17:19

  • hipoonios

  • Friend of XOOPS

  • Posts: 298

  • Since: 2005/9/24


Try the Avatar Manager module from Peak Xoops. I have used it myself and it works well. The module is a bit old now. So not sure if it works with latest Xoops version.
I love Xoops!

5
jimmyx
Re: Avatar bulk load?
  • 2011/9/29 0:39

  • jimmyx

  • Quite a regular

  • Posts: 338

  • Since: 2007/7/18


don't know if the module works maybe have to modified
since xoops 2.5 the location of avatar is now inside folder uploads/avatars instead of root upload

6
xoopdio
Re: Avatar bulk load?
  • 2011/9/29 2:22

  • xoopdio

  • Just popping in

  • Posts: 29

  • Since: 2011/9/27


Hello

Thanks for the answer.

Actually it works fine on Xoops 2.5.1 ! It imported all my avatars and simleys just fine. They are in the upload/root as Jimmyx noted but Xoops seems to agree on it.

I didn't test those on the frontend yet, I'll make a report.

Edit : Frontend works fine too : avatars and smileys !
Thanks again

7
Peekay
Re: Avatar bulk load?
  • 2011/9/29 7:56

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Thx for that link Hipoonios.

My immediate though was that it would be nice if Peak Xoops, or someone else, would change the upload path and release an new version, but as long as Xoops keeps backward compatibility for avatar locations, the module will work with older versions of Xoops as well as Xoops 2.5, which is good.
A thread is for life. Not just for Christmas.

8
xoopdio
Re: Avatar bulk load?
  • 2011/9/29 8:55

  • xoopdio

  • Just popping in

  • Posts: 29

  • Since: 2011/9/27


Hi

Actually I had a problem anyway, so I corrected the AVAMAN code. Please don't be too hard on me : that's my first hack ever.

If anyone find a better way, please tell me.

index.patch :

*** index_ori.php    2006-04-06 02:25:21.000000000 +0700
--- index_fin.php    2011-09-30 15:53:57.686817109 +0700
***************
*** 1,5 ****
--- 1,7 ----
    
define"XOOPS_UPLOAD_PATH_AVATARS" "../../../uploads/avatars" ) ;

  
$avaman_allowed_exts = array(
      
'gif' => 'image/gif' ,
      
'jpg' => 'image/jpeg' ,
***************
*** 
59,65 ****
                  list( 
$file $users ) = $db->fetchRow$result ) ;
                  if( 
$users ) continue ;
                  if( 
strstr$file '..' ) ) die( '.. found.' ) ;
!                 @
unlinkXOOPS_UPLOAD_PATH '/' $file ) ;
                  
$db->query"DELETE FROM ".$db->prefix("avatar")." WHERE avatar_id=$avatar_id) ;
              }
          }
--- 
61,67 ----
                  list( 
$file $users ) = $db->fetchRow$result ) ;
                  if( 
$users ) continue ;
                  if( 
strstr$file '..' ) ) die( '.. found.' ) ;
!                 @
unlinkXOOPS_UPLOAD_PATH_AVATARS '/' $file ) ;
                  
$db->query"DELETE FROM ".$db->prefix("avatar")." WHERE avatar_id=$avatar_id) ;
              }
          }
***************
*** 
126,136 ****
          if( empty( 
$avaman_allowed_exts[$ext] ) ) continue ;
          
$file_node substr$file_name $ext_pos ) ;
          
$save_file_name uniqid'savt' ) . '.' $ext ;
!         
$fw fopenXOOPS_UPLOAD_PATH.'/'.$save_file_name "w" ) ;
          if( ! 
$fw ) continue ;
          @
fwrite$fw $file['content'] ) ;
          @
fclose$fw ) ;
!         
$db->query"INSERT INTO ".$db->prefix("avatar")." SET avatar_file='".addslashes($save_file_name)."', avatar_name='".addslashes($file_node)."', avatar_mimetype='".addslashes(@$avaman_allowed_exts[$ext])."', avatar_created=UNIX_TIMESTAMP(), avatar_display=1, avatar_weight=0, avatar_type='S'" ) ;
  
          
$imported ++ ;
      }
--- 
128,138 ----
          if( empty( 
$avaman_allowed_exts[$ext] ) ) continue ;
          
$file_node substr$file_name $ext_pos ) ;
          
$save_file_name uniqid'savt' ) . '.' $ext ;
!         
$fw fopenXOOPS_UPLOAD_PATH_AVATARS.'/'.$save_file_name "w" ) ;
          if( ! 
$fw ) continue ;
          @
fwrite$fw $file['content'] ) ;
          @
fclose$fw ) ;
!         
$db->query"INSERT INTO ".$db->prefix("avatar")." SET avatar_file='avatars/".addslashes($save_file_name)."', avatar_name='".addslashes($file_node)."', avatar_mimetype='".addslashes(@$avaman_allowed_exts[$ext])."', avatar_created=UNIX_TIMESTAMP(), avatar_display=1, avatar_weight=0, avatar_type='S'" ) ;
  
          
$imported ++ ;
      }
***************
*** 
185,191 ****
      echo 
"
      
          $evenodd'>$avatar_id
!         $evenodd'>.XOOPS_UPLOAD_URL.'/'.urlencode($avatar_file)."' alt='' />
          $evenodd'>$avatar_id]' value='".htmlspecialchars($avatar_name,ENT_QUOTES)."' />
          $evenodd'> ".formatTimestamp($avatar_created)."
          $evenodd'>$avatar_id]' ".($avatar_display?"checked='checked'":"")." />
--- 187,193 ----
      echo "
      
<tr>
          <
td class='$evenodd'>$avatar_idtd>
!         <
td class='$evenodd'><img src='".XOOPS_UPLOAD_URL.'/'.$avatar_file."' alt='' />td>
          <
td class='$evenodd'><input type='text' size='24' name='avatar_names[$avatar_id]' value='".htmlspecialchars($avatar_name,ENT_QUOTES)."' />td>
          <
td class='$evenodd'".formatTimestamp($avatar_created)."td>
          <
td class='$evenodd'><input type='checkbox' name='avatar_displays[$avatar_id]' ".($avatar_display?"checked='checked'":"")." />td>


smilies.patch :

*** smilies_ori.php    2006-04-06 02:25:21.000000000 +0700
--- smilies_fin.php    2011-09-30 15:53:45.036817110 +0700
***************
*** 1,5 ****
--- 1,7 ----
    
define"XOOPS_UPLOAD_PATH_SMILIES" "../../../uploads/smilies" ) ;

  
$avaman_allowed_exts = array(
      
'gif' => 'image/gif' ,
      
'jpg' => 'image/jpeg' ,
***************
*** 
58,64 ****
              if( 
$result ) {
                  list( 
$file ) = $db->fetchRow$result ) ;
                  if( 
strstr$file '..' ) ) die( '.. found.' ) ;
!                 @
unlinkXOOPS_UPLOAD_PATH '/' $file ) ;
                  
$db->query"DELETE FROM ".$db->prefix("smiles")." WHERE id=$smiles_id) ;
              }
          }
--- 
60,66 ----
              if( 
$result ) {
                  list( 
$file ) = $db->fetchRow$result ) ;
                  if( 
strstr$file '..' ) ) die( '.. found.' ) ;
!                 @
unlinkXOOPS_UPLOAD_PATH_SMILIES '/' $file ) ;
                  
$db->query"DELETE FROM ".$db->prefix("smiles")." WHERE id=$smiles_id) ;
              }
          }
***************
*** 
125,135 ****
          if( empty( 
$avaman_allowed_exts[$ext] ) ) continue ;
          
$file_node substr$file_name $ext_pos ) ;
          
$save_file_name uniqid'smil' ) . '.' $ext ;
!         
$fw fopenXOOPS_UPLOAD_PATH.'/'.$save_file_name "w" ) ;
          if( ! 
$fw ) continue ;
          @
fwrite$fw $file['content'] ) ;
          @
fclose$fw ) ;
!         
$db->query"INSERT INTO ".$db->prefix("smiles")." SET smile_url='".addslashes($save_file_name)."', code='".addslashes(rawurldecode($file_node))."', display=0, emotion=''" ) ;
  
          
$imported ++ ;
      }
--- 
127,137 ----
          if( empty( 
$avaman_allowed_exts[$ext] ) ) continue ;
          
$file_node substr$file_name $ext_pos ) ;
          
$save_file_name uniqid'smil' ) . '.' $ext ;
!         
$fw fopenXOOPS_UPLOAD_PATH_SMILIES.'/'.$save_file_name "w" ) ;
          if( ! 
$fw ) continue ;
          @
fwrite$fw $file['content'] ) ;
          @
fclose$fw ) ;
!         
$db->query"INSERT INTO ".$db->prefix("smiles")." SET smile_url='smilies/".addslashes($save_file_name)."', code='".addslashes(rawurldecode($file_node))."', display=0, emotion=''" ) ;
  
          
$imported ++ ;
      }
***************
*** 
181,187 ****
      echo 
"
      
          $evenodd'>$smiles_id
!         $evenodd'>.XOOPS_UPLOAD_URL.'/'.urlencode($file)."' alt='' />
          $evenodd'>$smiles_id]' value='".htmlspecialchars($code,ENT_QUOTES)."' />
          $evenodd'>$smiles_id]' value='".htmlspecialchars($emotion,ENT_QUOTES)."' />
          $evenodd'>$smiles_id]' ".($display?"checked='checked'":"")." />
--- 183,189 ----
      echo "
      
<tr>
          <
td class='$evenodd'>$smiles_idtd>
!         <
td class='$evenodd'><img src='".XOOPS_UPLOAD_URL.'/'.$file."' alt='' />td>
          <
td class='$evenodd'><input type='text' size='12' name='codes[$smiles_id]' value='".htmlspecialchars($code,ENT_QUOTES)."' />td>
          <
td class='$evenodd'><input type='text' size='24' name='emotions[$smiles_id]' value='".htmlspecialchars($emotion,ENT_QUOTES)."' />td>
          <
td class='$evenodd'><input type='checkbox' name='displays[$smiles_id]' ".($display?"checked='checked'":"")." />td>


Complete with the modifications given here : Xoops Forum

And now you got a module AVAMAN which fully works with the Xoops 2.5.1.

Hope it would be useful.

9
Peekay
Re: Avatar bulk load?
  • 2011/9/29 10:18

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Thx Xoopdio. That's easy enough to implement.

The path could even take its value from a module pref, although I haven't downloaded the module yet so don't know if it even has any admin prefs.

Maybe your next challenge?!

These old utility modules are great projects for anyone wanting to get into module development for Xoops. You might enquire whether Peak plan to develop this anymore (the release is from 2006). If not, it would be a nice utility to bring up to speed.

Quote:
Edit : It seems anyway that the images don't appear in Peaks Xoop interface but they are loaded in the official one ??? I don't know why.


Not sure what you meant by this?
A thread is for life. Not just for Christmas.

10
Mamba
Re: Avatar bulk load?
  • 2011/9/29 11:13

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Quote:
You might enquire whether Peak plan to develop this anymore (the release is from 2006).

It seems like GIJoe from Peak doesn't develop anything anymore, so I don't expect any new versions from him.

But some of his modules are being maintained by XOOPS Japan community.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

Login

Who's Online

286 user(s) are online (165 user(s) are browsing Support Forums)


Members: 0


Guests: 286


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits