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

Solved CustomUI image size

Discussion in 'Development' started by KHAV, Oct 13, 2017.

  1. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    Hello

    I tried to put image in UI but it did not show up! I think it is so big or the image format does not match with UI (the picture i put was .png) so is there a specific size or format that should be the image?
     
  2. Mystic30

    Mystic30 Witch

    Messages:
    52
    GitHub:
    Mystic30
    can you post your code here?
     
  3. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    PHP:
    $api $this->getServer()->getPluginManager()->getPlugin("FormAPI");
    if(
    $api === null || $api->isDisabled()){
        return;
    }
    $form $api->createSimpleForm(function (Player $player, array $data){
        
    $result $data[0];
        if(
    $result === null){
            return;
        }
        switch(
    $result){
            case 
    0:
                
    $player->sendMessage("Ok!");
                return;
            case 
    1:
                
    $player->sendMessage("No");
                return;
        }
    });
    $form->setTitle("Example Form");
    $form->setContent("Would you like to X?");
    $folder $this->getDataFolder()."Image/";
    $form->addButton("Yes"1"http://tinypic.com/r/jsd7vt/9");
    $form->addButton("No");
    $form->sendToPlayer($player);
     
  4. Mystic30

    Mystic30 Witch

    Messages:
    52
    GitHub:
    Mystic30
    try this
    PHP:
    $form->addButton("Yes"1"http://oi67.tinypic.com/jsd7vt.jpg");
     
    KHAV likes this.
  5. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    it is working thanks
     
  6. Legoboy0215

    Legoboy0215 Witch

    Messages:
    64
    GitHub:
    legoboy0215
    In case anyone is wondering, you have to link to the actual image, not the imgur image viewer URL.
     
  7. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Isn't that obvious?
     
  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.