$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));
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;
}
$tail = $adopt->getTail();
$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));
Thanks! I got up to the part of adding tables but got lost because I don't know how to do that lol.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
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.Thanks! I got up to the part of adding tables but got lost because I don't know how to do that lol.
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;
}
$tail = $adopt->getTail();
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?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!
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 lolDo I just add a new table for each marking/base color to recreate this?
![]()
Wait this works on 1.3.6?! I'll try installing it on there instead!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)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
<?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;
}
}
?>
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);
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);
<?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."));
}
}
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());
}
<a href='[SITE URL]myadopts/manage/{$ownedAdopt->getID()}'><img src='/beanpets/images/adopts/pets/{$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.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!!
Oh it might be theOkay, 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>"));
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.{$ownedAdopt->getImgLastUpdate()}
Hmm, no luck.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.![]()
<img src='[SITE URL]/adoptimage/{$ownedAdopt->getID()}'>
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); }
public function getImage($fetchMode = ""){
$home = SCRIPTPATH."/";
return "{$home}images/adopts/pets/{$this->getAdoptID()}.png"; }
public function getManageLink(){
return new Link("myadopts/manage/{$this->getID()}", "<img src='{$this->model->getImage(Model::GUI)}' style='width:80%'"); }
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?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
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.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?
$composed_image = new \Imagick($images);
$clut = new \Imagick();
$composed_image = new \Imagick($images);
$clut = new \Imagick();
$timestamp = time();
$image = $composed_image->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN);
$image->setImageFormat('png');
header('Content-type: image/png');
echo $image->getImageBlob();
$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;
protected $lastupdate;
protected $imglastupdate;
public function getLastUpdate(){
return $this->lastupdate;
}
public function getImgLastUpdate(){
return $this->imglastupdate;
}
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()}";
}
}
$timestamp = time();
$mysidia->db->update("owned_adoptables", ["lastupdate" => $timestamp], "aid = '{$adopt->aid}'");
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());
}