1
Lf3T-Hn4D
imagemanager
  • 2004/6/15 5:05

  • Lf3T-Hn4D

  • Just popping in

  • Posts: 2

  • Since: 2004/6/15


Hi, I'm working on a personal module for learning XOOPS module developement purposes.

I have an admin section that holds a list of items. Now I want each of the item to beable to hold an image. I thought of using XOOPS imagemanager. But I'm stump as to how to use it for selecting the image I want for my item.

The imagemanager seemed to be hardcoded for the dhtmltextarea form.

If I were to write my own imageselector, what guideline should I be following? What classes are needed and how do I use them?

(I hope my question is clear. I really don't know how else to put it.)

2
winsion
Re: imagemanager
  • 2004/6/15 5:12

  • winsion

  • Just popping in

  • Posts: 55

  • Since: 2003/11/23


I had the same thing to make, I give you an example of what I have make :

include("admin_header.php");


$op 'form'


function 
formulaire() {

include 
XOOPS_ROOT_PATH."/class/xoopsformloader.php";
$my_form = new XoopsThemeForm("ALEATOIRE""formulaire""index.php");

$my_form->addElement(new XoopsFormText("Lien""lien"50100$lien), false);
$my_form->addElement(new XoopsFormText("Nom Lien""nomlien"50100$nomlien), false);
$my_form->setExtra"enctype='multipart/form-data'" ) ; 
$img_box = new XoopsFormFile("Image""photo"$max_imgsize);
$img_box->setExtra"size ='50'") ;
$my_form->addElement($img_box); 
$button_tray = new XoopsFormElementTray('' ,'');
$button_tray->addElement(new XoopsFormButton('''post',"Envoyer"'submit'));
$my_form->addElement($button_tray);
$my_form->display();
}

foreach ( 
$_POST as $k => $v ) { 
${
$k} = $v
}
if ( isset(
$post) ) {
$op 'post';
}

switch (
$op) {


case 
"post"
$max_imgsize 100000
$max_imgwidth 500
$max_imgheight 500
$allowed_mimetypes = array('image/gif''image/jpeg''image/pjpeg''image/x-png');
$img_dir XOOPS_ROOT_PATH "/modules/aleatoire/images" ;

include_once(
XOOPS_ROOT_PATH."/class/uploader.php");
$field $_POST["xoops_upload_file"][0] ; 

if( !empty( 
$field ) || $field != "" ) { 


$uploader = new XoopsMediaUploader($img_dir$allowed_mimetypes$max_imgsize$max_imgwidth$max_imgheight);
$uploader->setPrefix'img' ) ;
if( 
$uploader->fetchMedia$field ) && $uploader->upload() ) { 
$photo=$uploader->getSavedFileName();

} else { 
echo 
$uploader->getErrors();
}
}

$sql "INSERT INTO ".$xoopsDB->prefix("aleatoire")." (lien,nomlien,photo) VALUES ('$lien','$nomlien','$photo')";
                
$result=$xoopsDB->queryF($sql); 
              
redirect_header("index.php",1,'Enregistrement effectuĂ©');        

break; 

case 
'form':
default:
xoops_cp_header();

formulaire();

xoops_cp_footer();
break;
}

3
Lf3T-Hn4D
Re: imagemanager
  • 2004/6/15 5:22

  • Lf3T-Hn4D

  • Just popping in

  • Posts: 2

  • Since: 2004/6/15


Erm right. Isn't that just doing your own image manager rather than using Xoops'? That isn't really what I wanted. But thanks anyways

What I wanted was to have a image picker that uses Xoops' imagemanager and works somewhat like the avatar picker.

4
winsion
Re: imagemanager
  • 2004/6/15 5:34

  • winsion

  • Just popping in

  • Posts: 55

  • Since: 2003/11/23


oh sorry,I see what you want now. I cannot program imagemanager only with the dhtmltextarea form, to differently perhaps call it with the code Javascript?

it seems to me that for the avatars it uses the same system of upload that I have to show to you and its own viewer.(but is to be confirmed by the dev team ?)

Login

Who's Online

94 user(s) are online (49 user(s) are browsing Support Forums)


Members: 0


Guests: 94


more...

Donat-O-Meter

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

Latest GitHub Commits