1.3.6 Help with Dynamically Generated Images

Forum
Last Post
Threads / Messages

emotidogzz

Member
Member
Joined
Nov 17, 2023
Messages
47
Points
8
Mysidian Dollar
404
I need help on how to implement this mod into my website. How do I give users the option to adopt adoptables with different colors and markings?
 
Last edited:
Hi, welcome to Mysidia! Have you got the mod working with owned adopts? Essentially to make people be able to adopt pets from the adoption page you'll need to add the same fields in the adopts_adoptables database that you added to adopts_owned_adoptables. Then in adopt.php you find the insert statement and you need to add the new fields to it.


PHP:
$mysidia->db->insert("owned_adoptables", array("aid" => NULL, "type" => $adopt->getType(), "name" => $name, "owner" => $mysidia->user->username, "currentlevel" => 0, "totalclicks" => 0, "code" => $code,
                                                           "imageurl" => NULL, "usealternates" => $alts, "tradestatus" => 'fortrade', "isfrozen" => 'no', "gender" => $gender, "offsprings" => 0, "lastbred" => 0));

You also might need to open class_adoptable and add new functions to fetch the information you add to the database.

So for example if you wanted to add a tail mutation, you might add this to class_adoptable:

PHP:
protected $tail; //add this to the top with the other protected functions

public function getTail(){ //add this to the other public functions
        return $this->tail;
    }

Then in adopt.php you could scroll down to around line 33 and add this:

PHP:
$tail = $adopt->getTail();

And then you could change the insert statement to something like:

PHP:
$mysidia->db->insert("owned_adoptables", array("aid" => NULL, "type" => $adopt->getType(), "name" => $name, "owner" => $mysidia->user->username, "currentlevel" => 0, "totalclicks" => 0, "code" => $code,
                                                           "imageurl" => NULL, "usealternates" => $alts, "tradestatus" => 'fortrade', "isfrozen" => 'no', "gender" => $gender, "offsprings" => 0, "lastbred" => 0, "tail" => $tail));

Without more information it will be a bit hard to help as I'm not sure what fields you are wanting to add or anything, or how far you managed to get. Hopefully this could be enough to get you started though
 
Hi, welcome to Mysidia! Have you got the mod working with owned adopts? Essentially to make people be able to adopt pets from the adoption page you'll need to add the same fields in the adopts_adoptables database that you added to adopts_owned_adoptables. Then in adopt.php you find the insert statement and you need to add the new fields to it.


PHP:
$mysidia->db->insert("owned_adoptables", array("aid" => NULL, "type" => $adopt->getType(), "name" => $name, "owner" => $mysidia->user->username, "currentlevel" => 0, "totalclicks" => 0, "code" => $code,
                                                           "imageurl" => NULL, "usealternates" => $alts, "tradestatus" => 'fortrade', "isfrozen" => 'no', "gender" => $gender, "offsprings" => 0, "lastbred" => 0));

You also might need to open class_adoptable and add new functions to fetch the information you add to the database.

So for example if you wanted to add a tail mutation, you might add this to class_adoptable:

PHP:
protected $tail; //add this to the top with the other protected functions

public function getTail(){ //add this to the other public functions
        return $this->tail;
    }

Then in adopt.php you could scroll down to around line 33 and add this:

PHP:
$tail = $adopt->getTail();

And then you could change the insert statement to something like:

PHP:
$mysidia->db->insert("owned_adoptables", array("aid" => NULL, "type" => $adopt->getType(), "name" => $name, "owner" => $mysidia->user->username, "currentlevel" => 0, "totalclicks" => 0, "code" => $code,
                                                           "imageurl" => NULL, "usealternates" => $alts, "tradestatus" => 'fortrade', "isfrozen" => 'no', "gender" => $gender, "offsprings" => 0, "lastbred" => 0, "tail" => $tail));

Without more information it will be a bit hard to help as I'm not sure what fields you are wanting to add or anything, or how far you managed to get. Hopefully this could be enough to get you started though
Thanks! I got up to the part of adding tables but got lost because I don't know how to do that lol.
 
Thanks! I got up to the part of adding tables but got lost because I don't know how to do that lol.
Ah okay, well it depends what host you're using for your site. But essentially you want to open something called PHPMyAdmin and view the tables that were generated when you installed the script.

2023-11-20 21_18_11-localhost _ MySQL _ mysidia _ phpMyAdmin 5.2.0 and 8 more pages - Personal...png
2023-11-20 21_18_27-localhost _ MySQL _ mysidia _ phpMyAdmin 5.2.0 and 8 more pages - Personal...png

Then you click the one you want, to install the mod you're wanting it would be adopts_owned_adoptables and adopts_adoptables.

2023-11-20 21_18_44-localhost _ MySQL _ mysidia _ adopts_owned_adoptables _ phpMyAdmin 5.2.0 a...png

Mine will look a little different as I've made some changes (I'm also on 1.3.6). To add a new column, you navigate to 'Structure'.

2023-11-20 21_18_51-localhost _ MySQL _ mysidia _ adopts_owned_adoptables _ phpMyAdmin 5.2.0 a...png

Then scroll down and you can add a new column to it.

2023-11-20 21_18_57-localhost _ MySQL _ mysidia _ adopts_owned_adoptables _ phpMyAdmin 5.2.0 a...png

Then just press go and fill in the information it asks for. Then you can call the information in the code by opening the right class file. In this case class_ownedadoptable or class_adoptable.

Then if you added a new column called 'tail', for example, you'd put:

PHP:
protected $tail; //add this to the top with the other protected functions

public function getTail(){ //add this to the other public functions
        return $this->tail;
    }

And then you can use:

PHP:
$tail = $adopt->getTail();

to call it. Hopefully that helps!
 
Ah okay, well it depends what host you're using for your site. But essentially you want to open something called PHPMyAdmin and view the tables that were generated when you installed the script.

View attachment 647
View attachment 648

Then you click the one you want, to install the mod you're wanting it would be adopts_owned_adoptables and adopts_adoptables.

View attachment 649

Mine will look a little different as I've made some changes (I'm also on 1.3.6). To add a new column, you navigate to 'Structure'.

View attachment 650

Then scroll down and you can add a new column to it.

View attachment 651

Then just press go and fill in the information it asks for. Then you can call the information in the code by opening the right class file. In this case class_ownedadoptable or class_adoptable.

Then if you added a new column called 'tail', for example, you'd put:

PHP:
protected $tail; //add this to the top with the other protected functions

public function getTail(){ //add this to the other public functions
        return $this->tail;
    }

And then you can use:

PHP:
$tail = $adopt->getTail();

to call it. Hopefully that helps!
Tysm!!
 
Ah okay, well it depends what host you're using for your site. But essentially you want to open something called PHPMyAdmin and view the tables that were generated when you installed the script.

View attachment 647
View attachment 648

Then you click the one you want, to install the mod you're wanting it would be adopts_owned_adoptables and adopts_adoptables.

View attachment 649

Mine will look a little different as I've made some changes (I'm also on 1.3.6). To add a new column, you navigate to 'Structure'.

View attachment 650

Then scroll down and you can add a new column to it.

View attachment 651

Then just press go and fill in the information it asks for. Then you can call the information in the code by opening the right class file. In this case class_ownedadoptable or class_adoptable.

Then if you added a new column called 'tail', for example, you'd put:

PHP:
protected $tail; //add this to the top with the other protected functions

public function getTail(){ //add this to the other public functions
        return $this->tail;
    }

And then you can use:

PHP:
$tail = $adopt->getTail();

to call it. Hopefully that helps!
Do I just add a new table for each marking/base color to recreate this?
6503018441998336.png
 
Do I just add a new table for each marking/base color to recreate this?
6503018441998336.png
Yep, essentially! I have installed this mod on 1 3.6 so here's what mine looks like in the adopts_owned_adoptables table. I have a LOT lol

2023-11-20 23_31_14-localhost _ MySQL _ bean_pets_old _ adopts_owned_adoptables _ phpMyAdmin 5...png
2023-11-20 23_31_36-localhost _ MySQL _ bean_pets_old _ adopts_owned_adoptables _ phpMyAdmin 5...png

I have way more but that'll give an idea lol.

Here are some of the adopts I have generated from the above:

2023-11-20 23_43_07-Bean Pets and 7 more pages - Personal - Microsoft​ Edge.png 2023-11-20 23_43_22-Bean Pets and 7 more pages - Personal - Microsoft​ Edge.png 2023-11-20 23_43_29-Bean Pets and 7 more pages - Personal - Microsoft​ Edge.png
 
Yep, essentially! I have installed this mod on 1 3.6 so here's what mine looks like in the adopts_owned_adoptables table. I have a LOT lol

View attachment 652
View attachment 653

I have way more but that'll give an idea lol.

Here are some of the adopts I have generated from the above:

View attachment 654View attachment 655 View attachment 656
Okay... so added the tables (just copied urs tbh)

Screenshot (23).png

I'm not sure why it isn't working. I'm assuming it's because I haven't assigned anything to the adopts from the table? But idk how to do that.

Here is my imagemagick php code:

<?php
header('Content-type: image/png');
// Lets setup the database.
$mysidia = Registry::get("mysidia");

//A not-so-clean way to get the wid of the parent page
$fullurl = $_SERVER['REQUEST_URI'];
$scrub = explode('/',trim($fullurl,'/'));
$cleanwid = end($scrub);

$pet = $mysidia->db->select("adopts_owned_adoptables", array(), "wid='$cleanwid'")->fetchObject();
if($pet->level >= 1){
$images = array(
'https://emotidogs.online/picuploads/dog_images/adult/markings/' . $pet->body_marking1 . '.png',
'http://emotidogs.online/picuploads/dog_images/adult/colours/' . $pet->body_colour2 . '.png',
'http://emotidogs.online/picuploads/dog_images/adult/colours/' . $pet-> body_colour1 . '.png',
'http://emotidogs.online/picuploads/dog_images/adult/lineart.png'
);
}

);

}
// Remember to order these in reverse, the last element in the array should always be the top layer you will see (usually lineart). All images should be the same dimensions. The first element in the array is [0], not [1]!!!!


// This creates the Imagick class that we will use.
$composed_image = new \Imagick($images);

// Base
if($pet->age >= 12){
$composed_image->setIteratorIndex(2);
$composed_image->compositeImage( new \Imagick($images[1]), \Imagick::COMPOSITE_DSTIN, 0, 0 );
$composed_image->setIteratorIndex(3);
$composed_image->compositeImage( new \Imagick($images[1]), \Imagick::COMPOSITE_DSTIN, 0, 0 );
$composed_image->setIteratorIndex(4);
$composed_image->compositeImage( new \Imagick($images[1]), \Imagick::COMPOSITE_DSTIN, 0, 0 );
$composed_image->setIteratorIndex(5);
$composed_image->compositeImage( new \Imagick($images[1]), \Imagick::COMPOSITE_DSTIN, 0, 0 );
$composed_image->setIteratorIndex(6);
$composed_image->compositeImage( new \Imagick($images[1]), \Imagick::COMPOSITE_DSTIN, 0, 0 );
$composed_image->setIteratorIndex(8);
$composed_image->compositeImage( new \Imagick($images[1]), \Imagick::COMPOSITE_DSTIN, 0, 0 );
}
else{
$composed_image->setIteratorIndex(2);
$composed_image->compositeImage( new \Imagick($images[1]), \Imagick::COMPOSITE_DSTIN, 0, 0 );
$composed_image->setIteratorIndex(4);
$composed_image->compositeImage( new \Imagick($images[1]), \Imagick::COMPOSITE_DSTIN, 0, 0 );
}

// As you see above, by calling setIteratorIndex(), you switch your "working layer" to the layer you wish to modify.
// Now lets flatten it and display it. This creates a new Imagick instance to work with with only one flat image.
$image = $composed_image->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN);
$image->setImageFormat('png');

echo $image->getImageBlob();
?>
 
Ah okay, 1.3.6 is a bit different. I had to get it working for myself. I also changed it a little so I can use hex codes to colour layers, rather than just using pre-made images like the original tutorial. But I can try to help you get it working!

I'm going to start from the beginning as it'll be easier that way, so no worries if you've already done some steps. Also, I haven't actually gotten as far as making it work with the adopt page as I have spent all my time getting the layers exported as I have sooooo many to prepare and like 6 life stages per species. :LOL: The steps to get it working would be similar though. I might give it a shot in a few days.

Anyway, add your desired fields to your database. I have 3 species currently on my site, and some don't have all fields (the ones that aren't common across all species have NULL checked in the DB), but essentially I have the below. Feel free to take inspiration but you probably won't want all of them. It'll be unique to what kinda adopts/species you want to provide.

  Spoiler: List of DB fields 

  • species
  • body
  • body_colour1
  • body_colour2
  • body_marking1
  • body_marking2
  • body_marking3
  • body_marking4
  • body_marking1_colour
  • body_marking2_colour
  • body_marking3_colour
  • body_marking4_colour
  • body_marking1_opacity
  • body_marking2_opacity
  • body_marking3_opacity
  • body_marking4_opacity
  • mane (pony only)
  • mane_colour1 (pony only)
  • mane_colour2 (pony only)
  • mane_marking1 (pony only)
  • make_marking2 (pony only)
  • mane_marking1_colour (pony only)
  • mane_marking2_colour (pony only)
  • mane_marking1_opacity (pony only)
  • mane_marking2_opacity (pony only)
  • tail
  • tail_marking1
  • tail_marking2
  • tail_marking1_colour
  • tail_marking2_colour
  • tail_marking1_opacity
  • tail_marking2_opacity
  • ears
  • inner_ears_colour
  • ears_marking1
  • ears_marking2
  • ears_marking1_colour
  • ears_marking2_colour
  • ears_marking1_opacity
  • ears_marking2_opacity
  • horns
  • horns_colour
  • antenna (moth only)
  • antenna_marking1 (moth only)
  • antenna_marking2 (moth only)
  • antenna_marking1_colour (moth only)
  • antenna_marking2_colour (moth only)
  • antenna_marking1_opacity (moth only)
  • antenna_marking2_opacity (moth only)
  • face
  • iris_colour1
  • iris_colour2
  • sclera_colour
  • nose_colour
  • wings
  • wings_colour1
  • wings_colour2
  • wings_marking1
  • wings_marking2
  • wings_marking1_colour
  • wings_marking2_colour
  • wings_marking1_opacity
  • wings_marking2_opacity
  • extra_ears
  • extra_ears_colour
  • extra_antenna (moth only)
  • extra_antenna_colour (moth only)
  • extra_head
  • extra_head_colour
  • extra_wings
  • extra_wings_colour
  • extra_body
  • extra_body_colour
  • extra_legs
  • extra_legs_colour
  • extra_tail
  • extra_tail_colour
  • extra_mane (pony only)
  • extra_mane_colour (pony only)
  • effect
  • companion
  • frame
  • foreground
  • background

Now, we need to set up the images folder in your files. The default images folder is called 'picuploads' but I changed mine to 'images' as I won't be uploading images directly from the admincp. If you do, though, you can just go into the files and change all references for 'picuploads' to 'images'. Or whatever you want it to be called. Here is my file structure. Again, you will need to customise it for your own needs. I also have a LOT of layers so you might want to downgrade that lol.

  Spoiler: Folder structure 

  • images
    • adopts
      • background
      • cat_bean
        • adult
          • body
          • companion
          • ears
          • effects
          • extras
          • faces
          • horns
          • markings
          • tails
          • wings
        • baby
          • Same as adult
        • child
          • Same as adult
        • egg
          • egg
          • hatch1
          • hatch2
      • foreground
      • frame
      • mothing_bean
        • adult
          • antenna
          • body
          • companion
          • effects
          • extras
          • faces
          • markings
          • tails
          • wings
        • baby
          • Same as adult
        • child
          • Same as adult
        • egg
          • egg
          • hatch1
          • hatch2
      • pets
      • pony_bean
        • adult
          • body
          • companion
          • ears
          • effects
          • extras
          • faces
          • horns
          • manes
          • markings
          • tails
          • wings
        • baby
          • Same as adult
        • child
          • Same as adult
        • egg
          • egg
          • hatch1
          • hatch2

I also have more subfolders if needed, like if the body type needs to change the shading of the ears, for example. In which case in the ears folder I might have:

  • ears
    • fluffy_body
    • smooth_body
Again, it will heavily depend on your own needs.

As an example for how I break down the layers of the actual images I'll go over a basic cat on my site. No extras, just the minimum. Folder names in bold. I combine the shading and the linework together.

  Spoiler: Example 

  • cat_bean
    • adult
      • body
        • smooth_body_colour
        • smooth_body_lines
      • ears
        • fluffy_body
          • cat_ears_colour1_back
          • cat_ears_colour1_front
          • cat_ears_colour2_back (inner ear)
          • cat_ears_colour2_front (inner ear)
          • cat_ears_lines_back
          • cat_ears_lines_front
        • smooth_body
          • Same as fluffy body
      • faces
        • cat_face_iris_left (I split the irises so I can have heterochromia)
        • cat_face_iris_right
        • cat_face_lines
        • cat_face_nose
        • cat_face_sclera
      • tails
        • fluffy_body
          • cat_tail_colour1
          • cat_tail_colour2 (some tails use a second colour, the cat tail doesn't so this image is blank)
          • cat_tail_lines
        • smooth_body
          • Same as fluffy body

All exported colour images are black, as I use the code to colour them by hex. Technically it doesn't matter what colour they are, though, as the code replaces the entire image. So you could make them grey, or white, or pink if you wanted.

  Spoiler: Images 
2023-11-21 10_16_46-body.png
2023-11-21 10_26_11-fluffy_body.png

All together, they can combine to become these:

cat_bean (1).png


Now that all that is out of the way we can finally get to the code lol. So create a new file in controller/main called adoptimagecontroller.php. Put this inside:

PHP:
<?php

namespace Controller\Main;
use Resource\Core\AppController;
use Resource\Core\Registry;

class AdoptimageController extends AppController{

    public function __construct(){
        parent::__construct();   
    }
    
    public function index(){
        $mysidia = Registry::get("mysidia");
    }

    public function view($aid){
        $mysidia = Registry::get("mysidia");

        //A not-so-clean way to get the id of the parent page
        $fullurl = $_SERVER['REQUEST_URI'];
        $scrub = explode('/',trim($fullurl,'/'));
        $cleanaid  = end($scrub);

        $adopt = $mysidia->db->select("owned_adoptables", array(), "aid='$cleanaid'")->fetchObject();

        if($adopt->species == "cat_bean"){


            if($adopt->currentlevel == 0){
                //Snipped for length
            }
            elseif($adopt->currentlevel == 1){
                //Snipped for length
            }
            elseif($adopt->currentlevel == 2){
                //Snipped for length
            }
            elseif($adopt->currentlevel == 3){
              //Snipped for length
            }
            elseif($adopt->currentlevel == 4){
                //Snipped for length
            }
            elseif($adopt->currentlevel == 5){
                //Snipped for length
            }
        }


        // This creates the Imagick class that we will use.
        $composed_image = new \Imagick($images);
        $clut = new \Imagick();
        $timestamp = time();

        if($adopt->species == "cat_bean"){
            if($adopt->currentlevel == 0){
                $composed_image->setIteratorIndex(0);
                $composed_image->setImageBackgroundColor('transparent');
               //Snipped for length

            }
            if($adopt->currentlevel == 1){
                $composed_image->setIteratorIndex(0);
                $composed_image->setImageBackgroundColor('transparent');
               //Snipped for length
            }
            if($adopt->currentlevel == 2){
                $composed_image->setIteratorIndex(0);
                $composed_image->setImageBackgroundColor('transparent');
               //Snipped for length
            }
            if($adopt->currentlevel == 3){
                $composed_image->setIteratorIndex(0);
                $composed_image->setImageBackgroundColor('transparent');
               //Snipped for length
                
            }
            if($adopt->currentlevel == 4){
                $composed_image->setIteratorIndex(0);
                $composed_image->setImageBackgroundColor('transparent');
               //Snipped for length
                
            }
            if($adopt->currentlevel == 5){
                $composed_image->setIteratorIndex(0);
                $composed_image->setImageBackgroundColor('transparent');
               //Snipped for length
                
            }
        }
 
        $image = $composed_image->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN);
        $image->setImageFormat('png');

        header('Content-type: image/png');
        echo $image;
    }
}
?>

Again things will need to be customised for your own site depending on what species you have and how many life stages. I'll put the full examples for what I have for adults below so you can use them as a guide. For the most part it is all copied across all levels, except child and babies have less layers that display. Mainly markings. And eggs of course don't have all the mutations, just a shell colour, etc.
 
PHP:
elseif($adopt->currentlevel == 5){
                $images1 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\background\\' . $adopt->background . '.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\wings\\' . $adopt->body . '\\' . $adopt->wings . '_colour2_back.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\wings\\' . $adopt->body . '\\' . $adopt->wings . '_colour1_back.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\wings\\' . $adopt->wings . '\\' . $adopt->wings_marking2 . '_back.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\wings\\' . $adopt->wings . '\\' . $adopt->wings_marking1 . '_back.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\wings\\' . $adopt->body . '\\' . $adopt->wings . '_lines_back.png');
                
                if($adopt->extra_tail == "double_tail"){
                    $images2 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\tails\\' . $adopt->tail . '\\' . $adopt->extra_tail . '_colour2.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\tails\\' . $adopt->tail . '\\' . $adopt->extra_tail . '_colour1.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\extras\\tails\\' . $adopt->extra_tail . '\\' . $adopt->tail . '\\' . $adopt->tail_marking2 . '.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\extras\\tails\\' . $adopt->extra_tail . '\\' . $adopt->tail . '\\' . $adopt->tail_marking1 . '.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\tails\\' . $adopt->tail . '\\' . $adopt->extra_tail . '_lines.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\tails\\' . $adopt->tail . '\\none_colour.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\tails\\' . $adopt->tail . '\\none_lines.png');
                }
                else{
                    $images2 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\tails\\' . $adopt->body . '\\' . $adopt->tail . '_colour2.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\tails\\' . $adopt->body . '\\' . $adopt->tail . '_colour1.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\tails\\' . $adopt->tail . '\\' . $adopt->tail_marking2 . '.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\tails\\' . $adopt->tail . '\\' . $adopt->tail_marking1 . '.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\tails\\' . $adopt->body . '\\' . $adopt->tail . '_lines.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\tails\\' . $adopt->tail . '\\' . $adopt->extra_tail . '_colour.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\tails\\' . $adopt->tail . '\\' . $adopt->extra_tail . '_lines.png');
                }

                if($adopt->horns != "none"){
                    $images3 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\horns\\' . $adopt->body . '\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->ears . '_colour2_back.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\horns\\' . $adopt->body . '\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->ears . '_colour1_back.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\horns\\' . $adopt->body . '\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->horns . '_colour_back.png');

                        if($adopt->horns == "dragon_horns"){
                            $images4 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\horns\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->tail_marking2 . '_back.png',
                            'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\horns\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->tail_marking1 . '_back.png');
                        }
                        else{
                            $images4 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\horns\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->ears_marking2 . '_back.png',
                            'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\horns\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->ears_marking1 . '_back.png');
                        }

                    $images5 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\horns\\' . $adopt->body . '\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->horns . '_lines_back.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\ears\\' . $adopt->ears . '\\' . $adopt->horns . '\\' . $adopt->extra_ears . '_colour_back.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\ears\\' . $adopt->ears . '\\' . $adopt->horns . '\\' . $adopt->extra_ears . '_lines_back.png');
                }
                else{
                    $images3 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\ears\\' . $adopt->body . '\\' . $adopt->ears . '_colour2_back.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\ears\\' . $adopt->body . '\\' . $adopt->ears . '_colour1_back.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\horns\\' . $adopt->body . '\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->horns . '_colour_back.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\ears\\' . $adopt->ears . '\\' . $adopt->ears_marking2 . '_back.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\ears\\' . $adopt->ears . '\\' . $adopt->ears_marking1 . '_back.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\ears\\' . $adopt->body . '\\' . $adopt->ears . '_lines_back.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\ears\\' . $adopt->ears . '\\' . $adopt->extra_ears . '_colour_back.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\ears\\' . $adopt->ears . '\\' . $adopt->extra_ears . '_lines_back.png');
                }
                
                $images6 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\body\\' . $adopt->body . '_colour.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\body\\' . $adopt->body . '\\' . $markFace4 . $adopt->body_marking4 . '.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\body\\' . $adopt->body . '\\' . $markFace3 . $adopt->body_marking3 . '.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\body\\' . $adopt->body . '\\' . $markFace2 . $adopt->body_marking2 . '.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\body\\' . $adopt->body . '\\' . $markFace1 . $adopt->body_marking1 . '.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\body\\' . $adopt->body . '_lines.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\body\\' . $adopt->extra_body . '_colour.png');

                if($adopt->extra_body == "dragon_belly"){
                    $images7 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\extras\\body\\' . $adopt->body . '\\' . $adopt->extra_body . '\\' . $adopt->tail_marking2 . '.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\extras\\body\\' . $adopt->body . '\\' . $adopt->extra_body . '\\' . $adopt->tail_marking1 . '.png');
                }
                else{
                    $images7 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\extras\\body\\' . $adopt->body . '\\' . $adopt->extra_body . '\\' . $adopt->body_marking2 . '.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\extras\\body\\' . $adopt->body . '\\' . $adopt->extra_body . '\\' . $adopt->body_marking1 . '.png');
                }

                $images8 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\body\\' . $adopt->extra_body . '_lines.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\legs\\' . $adopt->extra_legs . '_colour.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\legs\\' . $adopt->extra_legs . '_lines.png');
                
                if($adopt->horns != "none"){
                    $images9 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\horns\\' . $adopt->body . '\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->ears . '_colour2_front.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\horns\\' . $adopt->body . '\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->ears . '_colour1_front.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\horns\\' . $adopt->body . '\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->horns . '_colour_front.png');

                        if($adopt->horns == "dragon_horns"){
                            $images10 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\horns\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->tail_marking2 . '_front.png',
                            'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\horns\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->tail_marking1 . '_front.png');
                        }
                        else{
                            $images10 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\horns\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->ears_marking2 . '_front.png',
                            'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\horns\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->ears_marking1 . '_front.png');
                        }
                    
                    $images11 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\horns\\' . $adopt->body . '\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->horns . '_lines_front.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\ears\\' . $adopt->ears . '\\' . $adopt->horns . '\\' . $adopt->extra_ears . '_colour_front.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\ears\\' . $adopt->ears . '\\' . $adopt->horns . '\\' . $adopt->extra_ears . '_lines_front.png');
                }
                else{
                    $images9 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\ears\\' . $adopt->body . '\\' . $adopt->ears . '_colour2_front.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\ears\\' . $adopt->body . '\\' . $adopt->ears . '_colour1_front.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\horns\\' . $adopt->body . '\\' . $adopt->horns . '\\' . $adopt->ears . '\\' . $adopt->horns . '_colour_front.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\ears\\' . $adopt->ears . '\\' . $adopt->ears_marking2 . '_front.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\ears\\' . $adopt->ears . '\\' . $adopt->ears_marking1 . '_front.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\ears\\' . $adopt->body . '\\' . $adopt->ears . '_lines_front.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\ears\\' . $adopt->ears . '\\' . $adopt->extra_ears . '_colour_front.png',
                    'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\ears\\' . $adopt->ears . '\\' . $adopt->extra_ears . '_lines_front.png');
                }
                
                $images12 = array('http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\faces\\' . $adopt->face . '_sclera.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\faces\\' . $adopt->face . '_iris_right.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\faces\\' . $adopt->face . '_iris_left.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\faces\\' . $adopt->face . '_nose.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\faces\\' . $adopt->face . '_lines.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\head\\' . $adopt->extra_head . '_colour.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\head\\' . $adopt->extra_head . '_lines.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\wings\\' . $adopt->body . '\\' . $adopt->wings . '_colour2_front.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\wings\\' . $adopt->body . '\\' . $adopt->wings . '_colour1_front.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\wings\\' . $adopt->wings . '\\' . $adopt->wings_marking2 . '_front.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\markings\\wings\\' . $adopt->wings . '\\' . $adopt->wings_marking1 . '_front.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\wings\\' . $adopt->body . '\\' . $adopt->wings . '_lines_front.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\wings\\' . $adopt->wings . '\\' . $adopt->extra_wings . '_colour_front.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\extras\\' . $adopt->body . '\\wings\\' . $adopt->wings . '\\' . $adopt->extra_wings . '_lines_front.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\effects\\' . $adopt->effect . '.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\cat_bean\\adult\\companion\\' . $adopt->companion . '.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\foreground\\' . $adopt->foreground . '.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\frame\\' . $adopt->frame . '.png',
                'http:\\\\127.0.0.1\\beanpets\\images\\adopts\\watermark.png');

                $images = array_merge($images1, $images2, $images3, $images4, $images5, $images6, $images7, $images8, $images9, $images10, $images11, $images12);
 
PHP:
if($adopt->species == "cat_bean"){
            if($adopt->currentlevel == 5){
                $composed_image->setIteratorIndex(0);
                $composed_image->setImageBackgroundColor('transparent');
                $composed_image->setIteratorIndex(1);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->wings_colour2")); // Colours the back wing second colour
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[1]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                $composed_image->setIteratorIndex(2);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->wings_colour1")); // Colours the back wing
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[2]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                $composed_image->setIteratorIndex(3);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->wings_marking2_colour")); // Colours wing marking 2
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[3]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->wings_marking2_opacity, \Imagick::CHANNEL_ALPHA);
                $composed_image->setIteratorIndex(4);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->wings_marking1_colour")); // Colours wing marking 1
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[4]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->wings_marking1_opacity, \Imagick::CHANNEL_ALPHA);
                $composed_image->setIteratorIndex(6);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_colour2")); // Colours the tail second colour
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[6]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                $composed_image->setIteratorIndex(7);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_colour1")); // Colours the tail
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[7]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                $composed_image->setIteratorIndex(8);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->tail_marking2_colour")); // Colours tail marking 2
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[8]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->tail_marking2_opacity, \Imagick::CHANNEL_ALPHA);
                $composed_image->setIteratorIndex(9);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->tail_marking1_colour")); // Colours tail marking 1
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[9]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->tail_marking1_opacity, \Imagick::CHANNEL_ALPHA);
                $composed_image->setIteratorIndex(11);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->extra_tail_colour")); // Colours the tail extra
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[11]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
               
                if($adopt->horns != "none"){
                    if($adopt->horns == "dragon_horns"){
                        if($adopt->tail == "dragon_tail"){
                            $composed_image->setIteratorIndex(13);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->inner_ears_colour")); // Colours the back inner ear
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[13]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->setIteratorIndex(14);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_colour1")); // Colours the back outer ear the same as the body
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[14]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->setIteratorIndex(15);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_colour2")); // Colours the back horn
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[15]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->setIteratorIndex(16);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->tail_marking2_colour")); // Colours back ear marking2
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[16]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->tail_marking2_opacity, \Imagick::CHANNEL_ALPHA);
                            $composed_image->setIteratorIndex(17);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->tail_marking1_colour")); // Colours back ear marking1
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[17]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->tail_marking1_opacity, \Imagick::CHANNEL_ALPHA);
                        }
                        elseif($adopt->extra_body == "dragon_belly" && $adopt->tail != "dragon_tail"){
                            $composed_image->setIteratorIndex(13);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->inner_ears_colour")); // Colours the back inner ear
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[13]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->setIteratorIndex(14);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_colour1")); // Colours the back outer ear the same as the body
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[14]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->setIteratorIndex(15);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_colour2")); // Colours the back horn
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[15]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->setIteratorIndex(16);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_marking2_colour")); // Colours back ear marking2
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[16]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->body_marking2_opacity, \Imagick::CHANNEL_ALPHA);
                            $composed_image->setIteratorIndex(17);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_marking1_colour")); // Colours back ear marking1
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[17]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->body_marking1_opacity, \Imagick::CHANNEL_ALPHA);
                        }
                        else{
                            $composed_image->setIteratorIndex(13);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->inner_ears_colour")); // Colours the back inner ear
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[13]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->setIteratorIndex(14);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_colour1")); // Colours the back outer ear the same as the body
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[14]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->setIteratorIndex(15);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->horns_colour")); // Colours the back horn
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[15]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->setIteratorIndex(16);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->ears_marking2_colour")); // Colours back ear marking2
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[16]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->ears_marking2_opacity, \Imagick::CHANNEL_ALPHA);
                            $composed_image->setIteratorIndex(17);
                            $clut->newImage(1, 1, new \ImagickPixel("$adopt->ears_marking1_colour")); // Colours back ear marking1
                            $composed_image->clutImage($clut);
                            $clut->destroy();
                            $composed_image->compositeImage( new \Imagick($images[17]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                            $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->ears_marking1_opacity, \Imagick::CHANNEL_ALPHA);
                        }
                    }
                    else{
                        $composed_image->setIteratorIndex(13);
                        $clut->newImage(1, 1, new \ImagickPixel("$adopt->inner_ears_colour")); // Colours the back inner ear
                        $composed_image->clutImage($clut);
                        $clut->destroy();
                        $composed_image->compositeImage( new \Imagick($images[13]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                        $composed_image->setIteratorIndex(14);
                        $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_colour1")); // Colours the back outer ear the same as the body
                        $composed_image->clutImage($clut);
                        $clut->destroy();
                        $composed_image->compositeImage( new \Imagick($images[14]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                        $composed_image->setIteratorIndex(15);
                        $clut->newImage(1, 1, new \ImagickPixel("$adopt->horns_colour")); // Colours the back horn
                        $composed_image->clutImage($clut);
                        $clut->destroy();
                        $composed_image->compositeImage( new \Imagick($images[15]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                        $composed_image->setIteratorIndex(16);
                        $clut->newImage(1, 1, new \ImagickPixel("$adopt->ears_marking2_colour")); // Colours back ear marking2
                        $composed_image->clutImage($clut);
                        $clut->destroy();
                        $composed_image->compositeImage( new \Imagick($images[16]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                        $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->ears_marking2_opacity, \Imagick::CHANNEL_ALPHA);
                        $composed_image->setIteratorIndex(17);
                        $clut->newImage(1, 1, new \ImagickPixel("$adopt->ears_marking1_colour")); // Colours back ear marking1
                        $composed_image->clutImage($clut);
                        $clut->destroy();
                        $composed_image->compositeImage( new \Imagick($images[17]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                        $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->ears_marking1_opacity, \Imagick::CHANNEL_ALPHA);
                    }
                }
                else{
                    $composed_image->setIteratorIndex(13);
                    $clut->newImage(1, 1, new \ImagickPixel("$adopt->inner_ears_colour")); // Colours the back inner ear
                    $composed_image->clutImage($clut);
                    $clut->destroy();
                    $composed_image->compositeImage( new \Imagick($images[13]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                    $composed_image->setIteratorIndex(14);
                    $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_colour1")); // Colours the back outer ear the same as the body
                    $composed_image->clutImage($clut);
                    $clut->destroy();
                    $composed_image->compositeImage( new \Imagick($images[14]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                    $composed_image->setIteratorIndex(16);
                    $clut->newImage(1, 1, new \ImagickPixel("$adopt->ears_marking2_colour")); // Colours back ear marking2
                    $composed_image->clutImage($clut);
                    $clut->destroy();
                    $composed_image->compositeImage( new \Imagick($images[16]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                    $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->ears_marking2_opacity, \Imagick::CHANNEL_ALPHA);
                    $composed_image->setIteratorIndex(17);
                    $clut->newImage(1, 1, new \ImagickPixel("$adopt->ears_marking1_colour")); // Colours back ear marking1
                    $composed_image->clutImage($clut);
                    $clut->destroy();
                    $composed_image->compositeImage( new \Imagick($images[17]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                    $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->ears_marking1_opacity, \Imagick::CHANNEL_ALPHA);
                }

                $composed_image->setIteratorIndex(19);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->extra_ears_colour")); // Colours the back ear extra
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[19]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                $composed_image->setIteratorIndex(21);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_colour1")); // Colours the body
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[21]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                $composed_image->setIteratorIndex(22);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_marking4_colour")); // Colours marking 4
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[22]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->body_marking4_opacity, \Imagick::CHANNEL_ALPHA);
                $composed_image->setIteratorIndex(23);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_marking3_colour")); // Colours marking 3
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[23]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->body_marking3_opacity, \Imagick::CHANNEL_ALPHA);
                $composed_image->setIteratorIndex(24);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_marking2_colour")); // Colours marking 2
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[24]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->body_marking2_opacity, \Imagick::CHANNEL_ALPHA);
                $composed_image->setIteratorIndex(25);
                $clut->newImage(1, 1, new \ImagickPixel("$adopt->body_marking1_colour")); // Colours marking 1
                $composed_image->clutImage($clut);
                $clut->destroy();
                $composed_image->compositeImage( new \Imagick($images[25]), \Imagick::COMPOSITE_DSTIN, 0, 0 ); // Keeps within colour
                $composed_image->evaluateImage(\Imagick::EVALUATE_MULTIPLY, $adopt->body_marking1_opacity, \Imagick::CHANNEL_ALPHA);

I had to snip quite a bit as there's a post limit of 20k characters lol. I can try to help further if you need it but it's so customised for your own site that it might be a little hard lol.
 
Last edited:
Next we need to make the view file. So in view/main create adoptimageview.php. Users shouldn't be able to see it so I just put a generic error.

PHP:
<?php

namespace View\Main;
use Resource\Core\Registry;
use Resource\Core\View;
use Resource\GUI\Document\Comment;

class AdoptimageView extends View{
    
    public function index(){
        $mysidia = Registry::get("mysidia");
        $document = $this->document;
        $document->setTitle("Oops...");
        $document->add(new Comment("You aren't supposed to be here."));
    }

    public function view(){
        $mysidia = Registry::get("mysidia");
        $document = $this->document;
        $document->setTitle("Oops...");
        $document->add(new Comment("You aren't supposed to be here."));
    }
}

Then finally you should be able to display the adopt images in myadoptsview.php by doing something like this:

PHP:
public function index(){
        $document = $this->document;
        $document->setTitle($this->lang->title);
 
        $pagination = $this->getField("pagination");
        $ownedAdopts = $this->getField("ownedAdopts");
        
        $ownedAdoptsIterator = $ownedAdopts->iterator();
        while($ownedAdoptsIterator->hasNext()){
            $ownedAdopt = $ownedAdoptsIterator->next();
                $document->add(new Comment("<a href='[SITE URL]myadopts/manage/{$ownedAdopt->getID()}'><img src='/beanpets/images/adopts/pets/{$ownedAdopt->getID()}.png?{$ownedAdopt->getImgLastUpdate()}' width='300px'></a>"));

        }
        $document->addLangvar($pagination->showPage());
    }

Essentially that uses:

PHP:
<a href='[SITE URL]myadopts/manage/{$ownedAdopt->getID()}'><img src='/beanpets/images/adopts/pets/{$ownedAdopt->getID()}.png?{$ownedAdopt->getImgLastUpdate()}' width='300px'></a>

...to display the pet. I can't remember what the vanilla script uses so you might need to change things depending on what your file contains. I can try to help further if you need it but yeah. Displaying the pet is essentially just a HTML image with the src being a link to the generated file.

Gosh sorry for the post spam, the 20k limit really got in the way lol!!
 
Next we need to make the view file. So in view/main create adoptimageview.php. Users shouldn't be able to see it so I just put a generic error.

PHP:
<?php

namespace View\Main;
use Resource\Core\Registry;
use Resource\Core\View;
use Resource\GUI\Document\Comment;

class AdoptimageView extends View{
   
    public function index(){
        $mysidia = Registry::get("mysidia");
        $document = $this->document;
        $document->setTitle("Oops...");
        $document->add(new Comment("You aren't supposed to be here."));
    }

    public function view(){
        $mysidia = Registry::get("mysidia");
        $document = $this->document;
        $document->setTitle("Oops...");
        $document->add(new Comment("You aren't supposed to be here."));
    }
}

Then finally you should be able to display the adopt images in myadoptsview.php by doing something like this:

PHP:
public function index(){
        $document = $this->document;
        $document->setTitle($this->lang->title);
 
        $pagination = $this->getField("pagination");
        $ownedAdopts = $this->getField("ownedAdopts");
       
        $ownedAdoptsIterator = $ownedAdopts->iterator();
        while($ownedAdoptsIterator->hasNext()){
            $ownedAdopt = $ownedAdoptsIterator->next();
                $document->add(new Comment("<a href='[SITE URL]myadopts/manage/{$ownedAdopt->getID()}'><img src='/beanpets/images/adopts/pets/{$ownedAdopt->getID()}.png?{$ownedAdopt->getImgLastUpdate()}' width='300px'></a>"));

        }
        $document->addLangvar($pagination->showPage());
    }

Essentially that uses:

PHP:
<a href='[SITE URL]myadopts/manage/{$ownedAdopt->getID()}'><img src='/beanpets/images/adopts/pets/{$ownedAdopt->getID()}.png?{$ownedAdopt->getImgLastUpdate()}' width='300px'></a>

...to display the pet. I can't remember what the vanilla script uses so you might need to change things depending on what your file contains. I can try to help further if you need it but yeah. Displaying the pet is essentially just a HTML image with the src being a link to the generated file.

Gosh sorry for the post spam, the 20k limit really got in the way lol!!
Okay, so added everything (wasn't as bad as I thought it would be since I don't have a lot of stuff to add) buut I broke my myadoptsview.php somehow.

Here it is.

Here's what I added:

public function index(){
$document = $this->document;
$document->setTitle($this->lang->title);

$pagination = $this->getField("pagination");
$ownedAdopts = $this->getField("ownedAdopts");

$ownedAdoptsIterator = $ownedAdopts->iterator();
while($ownedAdoptsIterator->hasNext()){
$ownedAdopt = $ownedAdoptsIterator->next();
$document->add(new Comment("<a href='http://emotidogs.online/myadopts/manage/{$ownedAdopt->getID()}'><img src='/picuploads/dog_images/adult/{$ownedAdopt->getID()}.png?{$ownedAdopt->getImgLastUpdate()}' width='300px'></a>"));
 
Okay, so added everything (wasn't as bad as I thought it would be since I don't have a lot of stuff to add) buut I broke my myadoptsview.php somehow.

Here it is.

Here's what I added:

public function index(){
$document = $this->document;
$document->setTitle($this->lang->title);

$pagination = $this->getField("pagination");
$ownedAdopts = $this->getField("ownedAdopts");

$ownedAdoptsIterator = $ownedAdopts->iterator();
while($ownedAdoptsIterator->hasNext()){
$ownedAdopt = $ownedAdoptsIterator->next();
$document->add(new Comment("<a href='http://emotidogs.online/myadopts/manage/{$ownedAdopt->getID()}'><img src='/picuploads/dog_images/adult/{$ownedAdopt->getID()}.png?{$ownedAdopt->getImgLastUpdate()}' width='300px'></a>"));
Oh it might be the
{$ownedAdopt->getImgLastUpdate()}
Try removing that from the image link? I accidentally left it in lol. On my site I have it so the images are saved to the site files when they're generated, because I have so many layers it takes like 10-20 seconds for each pet to generate, so in the DB I store the timestamp of when the pet was last edited and when the image was last saved and if the image is older than the last time the pet was changed it will re-generate the image to keep it up to date. Which means it only needs to be reloaded if the pet has been updated and not every time the pet is viewed. If you wanted something like that I could give you instructions for that too. :)
 
Oh it might be the

Try removing that from the image link? I accidentally left it in lol. On my site I have it so the images are saved to the site files when they're generated, because I have so many layers it takes like 10-20 seconds for each pet to generate, so in the DB I store the timestamp of when the pet was last edited and when the image was last saved and if the image is older than the last time the pet was changed it will re-generate the image to keep it up to date. Which means it only needs to be reloaded if the pet has been updated and not every time the pet is viewed. If you wanted something like that I could give you instructions for that too. :)
Hmm, no luck.

Maybe something is off in the adoptimagecontroller.php? Idk.
 
Last edited:
Oh! Okay, the image is linked wrong. Sorry, I have a cold so I didn't read it properly LOL. You don't have the image being saved directly to your files so you need to use the direct link to where the file is being generated. So the image src would be something like
PHP:
<img src='[SITE URL]/adoptimage/{$ownedAdopt->getID()}'>

Replace adoptimage with whatever the file is called that your pet is being generated from

Oh, also, I did some more work on my site, mainly displaying the adopts on the myadopts page and I managed to get it working with the default table. So here are the instructions for that if you want them. Though probably good to try and get the image loading first haha.

In model/domainmodel/ownedadoptable.php, replace public function construct with this:

PHP:
public function __construct($aid, $dto = NULL){
$mysidia = Registry::get("mysidia");
if(!$dto){ $dto = $mysidia->db->select("owned_adoptables", [], "aid = :aid", ["aid" => $aid])->fetchObject();
if(!is_object($dto)) throw new AdoptNotfoundException("Owned Adoptable ID {$aid} does not exist or does not belong to the owner specified...");
}
$this->createFromDTO($dto); }

That unlinks the adoptables and owned_adoptables table in the DB. If you're allowing users to make their own pets you might not be using the adoptables table and by default the site will often look for a connection between them (in the form of a common adopt ID) which if you're generating custom pets won't be there. So this way they don't need to be linked.

Find and replace public function getImage with this:

PHP:
public function getImage($fetchMode = ""){
 $home = SCRIPTPATH."/";
return "{$home}images/adopts/pets/{$this->getAdoptID()}.png"; }

Open model/viewmodel/ownedadoptableviewmodel.php. Find and replace public function getManageLink:

PHP:
public function getManageLink(){
return new Link("myadopts/manage/{$this->getID()}", "<img src='{$this->model->getImage(Model::GUI)}' style='width:80%'"); }

  Spoiler: Image 


And I think that should let you just use the default table that the script starts with. Let me know if you get any errors though as it's sometimes hard to remember everything I changed haha. I am currently working on getting custom pets generated through the adminCP and able to be adopted through the adopt page so stay tuned for that if you're interested
 

Attachments

  • screencapture-127-0-0-1-bean-pets-myadopts-2023-11-22-20_02_36.png
    screencapture-127-0-0-1-bean-pets-myadopts-2023-11-22-20_02_36.png
    844.9 KB · Views: 2
Last edited:
Oh! Okay, the image is linked wrong. Sorry, I have a cold so I didn't read it properly LOL. You don't have the image being saved directly to your files so you need to use the direct link to where the file is being generated. So the image src would be something like
PHP:
<img src='[SITE URL]/adoptimage/{$ownedAdopt->getID()}'>

Replace adoptimage with whatever the file is called that your pet is being generated from

Oh, also, I did some more work on my site, mainly displaying the adopts on the myadopts page and I managed to get it working with the default table. So here are the instructions for that if you want them. Though probably good to try and get the image loading first haha.

In model/domainmodel/ownedadoptable.php, replace public function construct with this:

PHP:
public function __construct($aid, $dto = NULL){
$mysidia = Registry::get("mysidia");
if(!$dto){ $dto = $mysidia->db->select("owned_adoptables", [], "aid = :aid", ["aid" => $aid])->fetchObject();
if(!is_object($dto)) throw new AdoptNotfoundException("Owned Adoptable ID {$aid} does not exist or does not belong to the owner specified...");
}
$this->createFromDTO($dto); }

That unlinks the adoptables and owned_adoptables table in the DB. If you're allowing users to make their own pets you might not be using the adoptables table and by default the site will often look for a connection between them (in the form of a common adopt ID) which if you're generating custom pets won't be there. So this way they don't need to be linked.

Find and replace public function getImage with this:

PHP:
public function getImage($fetchMode = ""){
 $home = SCRIPTPATH."/";
return "{$home}images/adopts/pets/{$this->getAdoptID()}.png"; }

Open model/viewmodel/ownedadoptableviewmodel.php. Find and replace public function getManageLink:

PHP:
public function getManageLink(){
return new Link("myadopts/manage/{$this->getID()}", "<img src='{$this->model->getImage(Model::GUI)}' style='width:80%'"); }

  Spoiler: Image 


And I think that should let you just use the default table that the script starts with. Let me know if you get any errors though as it's sometimes hard to remember everything I changed haha. I am currently working on getting custom pets generated through the adminCP and able to be adopted through the adopt page so stay tuned for that if you're interested
Thank you! Ooh, sounds cool! How do I have the images saved to files? Will the code be able to run on its own with that instead of having to manually insert the imageurl each time?
 
Last edited:
Thank you! Ooh, sounds cool! How do I have the images saved to files? Will the code be able to run on its own with that instead of having to manually insert the imageurl each time?
Okay to save the files you need to make a folder for them. So in your picuploads make a new folder specifically for adopt images. They will be saved with the filename of their ID so it will be something like 1.png. Then they get overwritten whenever the pet is updated.

2023-11-22 21_41_52-pets.png

In your ownedadoptables table make 2 new columns.

lastupdate
imglastupdate

Make both be INT type and do NOT check the NULL box.

Then in adoptimagecontroller.php, change:

PHP:
$composed_image = new \Imagick($images);
        $clut = new \Imagick();

to:

PHP:
$composed_image = new \Imagick($images);
        $clut = new \Imagick();
        $timestamp = time();

It might already be like that if I forgot to delete the timestamp line before. i think I did lol.

Then change this:

PHP:
$image = $composed_image->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN);
    $image->setImageFormat('png');

    header('Content-type: image/png');
    echo $image->getImageBlob();

to:

PHP:
$image = $composed_image->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN);
        $image->setImageFormat('png');
        
        
if($adopt->lastupdate >= $adopt->imglastupdate && file_exists('C:\\wamp64\\www\\bean-pets\\images\\adopts\\pets\\' . $adopt->aid . '.png')){
            unlink('C:\\wamp64\\www\\bean-pets\\images\\adopts\\pets\\' . $adopt->aid . '.png');
        }
        else{
            $mysidia->db->update("owned_adoptables", ["lastupdate" => $timestamp, "imglastupdate" => $timestamp], "aid = '{$adopt->aid}'");
            $storepath = 'C:\\wamp64\\www\\bean-pets\\images\\adopts\\pets\\' . $adopt->aid . '.png';
            $image->writeImage($storepath);
        }
        header('Content-type: image/png');
        echo $image;

That essentially says if the lastupdate field is the same as or newer than imglastupdate, delete the currently stored image and regenerate it. If the lastupdate it older than when the image was updated it uses the stored image instead.

Then in model/domainmodel/ownedadoptable.php, at the top with the other protected functions add:

PHP:
protected $lastupdate;
    protected $imglastupdate;

And with the other public functions, add:

PHP:
public function getLastUpdate(){
        return $this->lastupdate;
    }
    public function getImgLastUpdate(){
        return $this->imglastupdate;
    }

Then change getImage to:

PHP:
public function getImage($fetchMode = ""){
        $home = SCRIPTPATH."/";
        if($this->getLastUpdate() != $this->getImgLastUpdate() || !file_exists("C:\\wamp64\\www\\bean-pets\\images\\adopts\\pets\\{$this->getAdoptID()}.png")){
            return "{$home}adoptimage/view/{$this->getAdoptID()}";
        }
        else{
            return "{$home}images/adopts/pets/{$this->getAdoptID()}.png?{$this->getImgLastUpdate()}";
        }       
    }

Then whenever you want to get the image you can use {$ownedAdopt->getManageLink()} to get the image with user manage link or {$ownedAdopt->getImage} for just the picture.

Let me know if there are any errors as I might have forgotten a step lol

You then need to keep in mind to update the 'lastupdate' field with a new timestamp whenever the pet image gets changed. So if you make an item that can change the colour of the pet, you need to remember to add something like:

PHP:
$timestamp = time();
$mysidia->db->update("owned_adoptables", ["lastupdate" => $timestamp], "aid = '{$adopt->aid}'");

...to the item function (you define item functions in itemfunction.php and the DB). I haven't got that far myself yet so that might not work as-is but I'll get to it eventually lol.
 
If you want to go back to the default myadopts view with the table, instead of using the iterator to display pets, change public function index in myadoptsview.php to this:

PHP:
public function index(){
        $document = $this->document;
        $document->setTitle($this->lang->title);
 
        $pagination = $this->getField("pagination");
        $ownedAdopts = $this->getField("ownedAdopts");
        
        $adoptTable = new TableBuilder("adopttable", 650);
        $adoptTable->setAlign(new Align("center", "middle"));
        $adoptTable->buildHeaders("Gender", "Name/Type", "Image", "Level", "Clicks");
        $ownedAdoptsIterator = $ownedAdopts->iterator();
        while($ownedAdoptsIterator->hasNext()){
            $ownedAdopt = $ownedAdoptsIterator->next();
            $cells = new LinkedList;
            $cells->add(new TCell($ownedAdopt->getGenderImage()));
            $cells->add(new TCell($ownedAdopt->getTypeAndName()));
            $cells->add(new TCell($ownedAdopt->getManageLink()));
            $cells->add(new TCell($ownedAdopt->getCurrentLevel()));
            $cells->add(new TCell($ownedAdopt->getTotalClicks()));
            $adoptTable->buildRow($cells);
        }
        $document->add($adoptTable);
        $document->addLangvar($pagination->showPage());
    }

$ownedAdopt->getManageLink() is what displays the image, which we defined just now :3
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,258
Messages
33,010
Members
1,600
Latest member
SusieHanson
BETA

Latest Threads

Latest Posts

Top