1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Form with Images

Discussion in 'Help' started by TheKevnSG, Aug 5, 2019.

  1. TheKevnSG

    TheKevnSG Silverfish

    Messages:
    18
    GitHub:
    thekevinsg
    Hello, someone knows how to put images in a form
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Are you using a form API? If so, which one?
     
    EdwardHamHam likes this.
  3. TheKevnSG

    TheKevnSG Silverfish

    Messages:
    18
    GitHub:
    thekevinsg
    Yes simpleform
     
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    You can add a link to an image like this:
    PHP:
    $text "Sample Text";
    $imagePath "https://i.imgur.com/I0vNqpO.png"// Put your image URL here
    $form->addButton($textSimpleForm::IMAGE_TYPE_URL$imagePath);
     
    EdwardHamHam likes this.
  5. TheKevnSG

    TheKevnSG Silverfish

    Messages:
    18
    GitHub:
    thekevinsg
    Error: "Class 'Games\SimpleForm' not found" (EXCEPTION) in "plugins/GamesUi/src/Games/Main" at line 63

    Line: $form->addButton($text, SimpleForm::IMAGE_TYPE_URL, $imagePath);
     
  6. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Can you show me the whole code?
     
  7. TheKevnSG

    TheKevnSG Silverfish

    Messages:
    18
    GitHub:
    thekevinsg
    $form->setTitle("title");
    $form->setContent("Content");
    $text = "Sample Text";
    $imagePath = "
    "; // Put your image URL here
    $form->addButton($text, SimpleForm::IMAGE_TYPE_URL, $imagePath);
    $form->sendToPlayer($sender);
     
    isoz likes this.
  8. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Put
    PHP:
    use jojoe77777\FormAPI\SimpleForm;
    at the top of your code.

    In the future use code and php tags in order to make code more readable, you can do this by pressing the "+" button of the post field and then pressing "Code".
    You can also write it like this:

    [php]php code here[/php]
    or
    [code]config files here [/code]
     
  9. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    PHP:
    $form $this->getServer()->getPluginManger()->getPlugin("FormAPI")->createSimpleForm(function (Player $p$data){
    if(
    $data === null){
    retrun true;
    }
    switch(
    $data){
    case 
    0:
    break;
    }
    });
    $form->setTitle("Test");
    //0 patting, 1 Url
    $url "https://camo.githubusercontent.com/5d19832972927279cbecd9c74dd50078d1dc74ca/68747470733a2f2f692e696d6775722e636f6d2f6549327861424c2e706e67"//paste your url
    $form->addButton("Text"1$url");
    I think this easy
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.