Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Off Topic Discussions > Adoptables Sites Showcase

Reply
 
Thread Tools Display Modes
  #11  
Old 04-14-2015, 11:11 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 843
Gender: Unknown/Other
Credits: 36,439
Kyttias is on a distinguished road
Default

By default, on pages like /myadopts, the framework calls up a pet's image with the function $adopt->getImage("gui"), where $adopt is, of course, $adopt = new OwnedAdoptable($aid), and the $aid is being obtained by looping through the objects made by the database query statement. All of these pages are calling the getImage() function from inside the OwnedAdoptable class. I'd open up classes/class_ownedadoptable.php and search for public function getImage and perhaps modify things there.

BUT, you've made changes to the default process. I'm not sure what changes you've made, but perhaps create a new function to call every time getImage() was, sitewide, in its place, that would better suit your needs. Or change the contents of getImage() or modify whatever function you're already currently using.

I can, however, tell you that in classes/class_ownedadoptable.php, you can acquire things from the current pet's table in the database by simply going $this->columnname. I added all the new columns as variables to the top of this file, too, for good measure, alongside the existing one. So if you made a column to hold the pet's background image, perhaps it would be $this->bg. If you had a folder somewhere you were storing all the background images, I'd store just the filename, without even so much as the extension, and not the location.

If you're storing the pet's image inside $this->imageurl, then maybe something like this:

PHP Code:
public function getLayers(){
    if ( 
$this->bg ){ $bg "<img class='layer' src='../../whereverthesearebeingstored/".$this->bg.".png'>"; }    
    if ( 
$this->item1 ){ $item1 "<img class='layer' src='../../whereverthesearebeingstored/".$this->item1.".png'>"; }  
    if ( 
$this->item2 ){ $item2 "<img class='layer' src='../../whereverthesearebeingstored/".$this->item2.".png'>"; }  
    if ( 
$this->item3 ){ $item3 "<img class='layer' src='../../whereverthesearebeingstored/".$this->item3.".png'>"; }  
    if ( 
$this->item4 ){ $item4 "<img class='layer' src='../../whereverthesearebeingstored/".$this->item4.".png'>"; }  
    if ( 
$this->item5 ){ $item5 "<img class='layer' src='../../whereverthesearebeingstored/".$this->item5.".png'>"; }  
    
    
$layers "<div class='petcontainer'>
        "
.$bg."
        <img class='layer' src='../../whereverthesearebeingstored/"
.$this->imageurl.".png'>
        "
.$item1.$item2.$item3.$item4.$item5."
        </div>"
;

    return 
$layers;

This isn't merging images with php, just storing rendering them as individual images. To make these images stay on top of one another, you'll just need some css:

Code:
.layer { position:absolute; left:0; top:0; }
.petcontainer { position:relative; }
From there you could always add more classes to control the size of the container and pet being rendered, or have them display inline, etc.

If you want images different for each pet (for example, with items), I'd suggest storing them in a folder structure based on $this->type, so long as everything sharing a species type shares the same body structure. Perhaps you can think of another variable to base this off of, if it better suits what you're doing.


Hopefully this pointed you somewhere in the right direction, even if its not how you'll do things in the end.
__________________
Please do not contact me. I cannot offer tech support on any coding I've done prior to 2018.

Last edited by Kyttias; 04-14-2015 at 11:15 PM.
Reply With Quote
  #12  
Old 04-14-2015, 11:27 PM
Missy Master's Avatar
Missy Master Missy Master is offline
*~Pet-Sim Com!~*
 
Join Date: Jan 2010
Posts: 448
Gender: Unknown/Other
Credits: 13,267
Missy Master is an unknown quantity at this point
Default

Wow thank you so much!! <3

I will give this a shot and see if I can do it right, looks like you really gave a good way to make this happen! Thank you for posting this! :) *Crosses fingers *
__________________
Reply With Quote
  #13  
Old 04-15-2015, 12:43 AM
Missy Master's Avatar
Missy Master Missy Master is offline
*~Pet-Sim Com!~*
 
Join Date: Jan 2010
Posts: 448
Gender: Unknown/Other
Credits: 13,267
Missy Master is an unknown quantity at this point
Default

I made an extra column for owned adoptables in the database for 'bg' and --I have this now in class_ownedadoptable:


Code:
  public function getLayers(){
    if ( $this->bg ){ $bg = "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->bg.".png'>"; }    
    if ( $this->item1 ){ $item1 = "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item1.".png'>"; }  
    if ( $this->item2 ){ $item2 = "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item2.".png'>"; }  
    if ( $this->item3 ){ $item3 = "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item3.".png'>"; }  
    if ( $this->item4 ){ $item4 = "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item4.".png'>"; }  
    if ( $this->item5 ){ $item5 = "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item5.".png'>"; }  
    
    $layers = "<div class='petcontainer'>
        ".$bg."
        <img class='layer' src='http://pet-sim.com/Canidae/bgimages".$this->imageurl.".png'>
        ".$item1.$item2.$item3.$item4.$item5."
        </div>";

    return $layers;
}
In which bgimages is the folder I will have the background images in --- but I am stumped as to how to proceed. I likely don't even have this part right --- Sorry, I don't do well at all with this coding!

Also, where do I put the little snippet of css for the layering to show?


Sorry to be so much trouble :(
__________________
Reply With Quote
  #14  
Old 04-15-2015, 01:32 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 843
Gender: Unknown/Other
Credits: 36,439
Kyttias is on a distinguished road
Default

The code looks fine to me. For the images for your items, just link them all up to the same items folder, and then you can keep your items separate from your background images.

You should be putting the css with the rest of the css for your theme. If you don't have it, the images will show up side by side.

getLayers() is just an example function name, of course. You need to call this function everywhere you want the pet image to show. How are you currently making your pet images appear? I explained how it was done by default, but again, you've made changes to the default framework, so it's difficult to instruct you on how to proceed.
__________________
Please do not contact me. I cannot offer tech support on any coding I've done prior to 2018.
Reply With Quote
  #15  
Old 04-15-2015, 11:42 PM
Missy Master's Avatar
Missy Master Missy Master is offline
*~Pet-Sim Com!~*
 
Join Date: Jan 2010
Posts: 448
Gender: Unknown/Other
Credits: 13,267
Missy Master is an unknown quantity at this point
Default

I'm using your gorgeous Bootstrap theme, and I'm not sure where to insert the code snippet to show the background and pet--- I see several css files in the theme folder.



All I really want is a working background system, and if it can be modded to insert toys as well that would be great. I'm really hoping to get this going!
__________________

Last edited by Missy Master; 04-16-2015 at 01:13 AM.
Reply With Quote
  #16  
Old 04-16-2015, 01:26 AM
Missy Master's Avatar
Missy Master Missy Master is offline
*~Pet-Sim Com!~*
 
Join Date: Jan 2010
Posts: 448
Gender: Unknown/Other
Credits: 13,267
Missy Master is an unknown quantity at this point
Default

Okay I have this in class_ownedadoptables and in myadopts too :


Code:

public function getLayers(){
    if ( $this->background){ $background= "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->background.".png'>"; }    
    if ( $this->item1 ){ $item1 = "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item1.".png'>"; }  
    if ( $this->item2 ){ $item2 = "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item2.".png'>"; }  
    if ( $this->item3 ){ $item3 = "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item3.".png'>"; }  
    if ( $this->item4 ){ $item4 = "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item4.".png'>"; }  
    if ( $this->item5 ){ $item5 = "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item5.".png'>"; }  
    
    $layers = "<div class='petcontainer'>
        ".$background."
        <img class='layer' src='http://pet-sim.com/Canidae/".$this->imageurl.".png'>
        ".$item1.$item2.$item3.$item4.$item5."
        </div>";

    return $layers;
}

Nothing is showing still on the profile .. I'm guessing because I dont have the css snippet in yet, but even so, it should be showing side by side.

The pet image is in imageurl in the database in owned adopts. The full URL ...

The background image is in background, in the owned adopts table ... just the file name.

Not sure what I am doing wrong still!

I am not good with this coding sorry :(
__________________
Reply With Quote
  #17  
Old 04-16-2015, 03:30 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 843
Gender: Unknown/Other
Credits: 36,439
Kyttias is on a distinguished road
Default

Could you show me where you are calling the function on your profile?
__________________
Please do not contact me. I cannot offer tech support on any coding I've done prior to 2018.
Reply With Quote
  #18  
Old 04-16-2015, 10:25 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 843
Gender: Unknown/Other
Credits: 36,439
Kyttias is on a distinguished road
Default

Alright, as far as my Bootstrap theme goes - style-kyt.css is what is being used for additional styling to make the Bootstrap stuff compatible with Mysidia. You can add the additional styles to the end of this, since it's being used on every page.

As for making backgrounds show up every time your pets do, I NEED to know how you're CURRENTLY displaying pets. You've modified the base code because of your breeding modifications and you're storing pet images differently and pulling them differently. I don't know where you've made changes and I don't know what you're code currently looks like. Without knowing anything more than what I already know I'll tell you again:

You need to call the getLayers() function we justmade every single time a pet is displayed. I already explained that the default framework is using a function called getImage(). Here are most of the places its being called, thanks the search function in my text editor:



There's also a few other locations, such as favpet->getImage( that you'd have to search for. Possibly more, any place where new OwnedAdoptable isn't being stored as $adopt, really. And I don't know just how many times that is in the framework.

I don't know what you're doing in these locations, because you've modified the base framework to change how pets are already displayed. Either you're calling them the same way you are by default, or you modified the getImage() function inside of class_ownedadoptables long ago. If your files are the same as the image, you can change these to getLayers(), as originally instructed. Hopefully this won't get too much more complicated.

Or you could comment out the existing getImage() function in class_ownedadoptables and keep it there as a backup and create a new one with the same name and simply replace its contents and see how that goes. You don't need "gui" as a parameter when calling my function, however, so it might throw some angry errors when it receives such a thing, since the original getImage() function can get one, but I dunno.

So try this:
PHP Code:
public function getImage($fetchMode ""){
    if(
$this->currentlevel == 0) return $this->getEggImage($fetchMode);
    
    if ( 
$this->bg ){ $bg "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->bg.".png'>"; }    
    if ( 
$this->item1 ){ $item1 "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item1.".png'>"; }  
    if ( 
$this->item2 ){ $item2 "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item2.".png'>"; }  
    if ( 
$this->item3 ){ $item3 "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item3.".png'>"; }  
    if ( 
$this->item4 ){ $item4 "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item4.".png'>"; }  
    if ( 
$this->item5 ){ $item5 "<img class='layer' src='http://pet-sim.com/Canidae/bgimages/".$this->item5.".png'>"; }  
    
    
$layers "<div class='petcontainer'>
        "
.$bg."
        <img class='layer' src='http://pet-sim.com/Canidae/bgimages"
.$this->imageurl.".png'>
        "
.$item1.$item2.$item3.$item4.$item5."
        </div>"
;

    return 
$layers;            

But keep the original on hand:
PHP Code:
public function getImage($fetchMode ""){
    if(
$this->imageurl) return $this->getImageUrl($fetchMode);
    if(
$this->currentlevel == 0) return $this->getEggImage($fetchMode);
    
    
$mysidia Registry::get("mysidia");        
    
$level $this->getCurrentLevel("model");
    if(
$this->useAlternates() == "yes") return $level->getAlternateImage($fetchMode);
    else return 
$level->getPrimaryImage($fetchMode);            

If you haven't already added slots in the database for the items (since you wanted items) go ahead and do so, because calling the database before them before there are columns there, even empty ones, could cause some very confused errors.

If you've actively using alternate images for pets based on the original framework, you'll have to make some more changes, taking a cue from the original function to check if the current pet usesAlternates().
__________________
Please do not contact me. I cannot offer tech support on any coding I've done prior to 2018.

Last edited by Kyttias; 04-16-2015 at 10:46 AM.
Reply With Quote
  #19  
Old 04-16-2015, 11:43 AM
Missy Master's Avatar
Missy Master Missy Master is offline
*~Pet-Sim Com!~*
 
Join Date: Jan 2010
Posts: 448
Gender: Unknown/Other
Credits: 13,267
Missy Master is an unknown quantity at this point
Default

I'm sorry, I'm not trying to frustrate you.

Quote:
As for making backgrounds show up every time your pets do, I NEED to know how you're CURRENTLY displaying pets.
I really am trying to answer what you're asking. I dont understand some of it, as I keep saying I am really NOT good with the new Mysid coding. I didn't modify most of it, HoF has graciously helped me with much of what I have thats modded.

All I can do is attach my files and hope it makes sense that way. I am sorry I just don't really understand what you are asking about. I did a lot of mods for the old script but object oriented I really have trouble understanding and I don't know why.

But as far as I know, it's all being called the default way you described.

The only difference I KNOW of, is in breeding we make a new image for the baby and insert that in the imageurl field. I don't think there is any difference at all in how we call the image up in the coding.
Attached Files
File Type: php myadopts.php (5.7 KB, 3 views)
File Type: php class_ownedadoptable.php (9.4 KB, 1 views)
File Type: php levelup (1).php (8.2 KB, 1 views)
File Type: php myadoptsview.php (8.4 KB, 1 views)

Last edited by Missy Master; 04-16-2015 at 11:47 AM.
Reply With Quote
  #20  
Old 04-16-2015, 11:50 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 843
Gender: Unknown/Other
Credits: 36,439
Kyttias is on a distinguished road
Default

I only had to open up one file and search for one of the lines in the image I posted to tell you that, no, nothing has been modified and if you want to go ahead and change the getImage() function in classes/class_ownedadoptables.php I posted last, things should work. Just open that file up and search for:

public function getImage($fetchMode = ""){

Make a copy of that function, comment out one, rename it, whatever, just so you have a backup of it. Then change the contents of the original (see my last post for what I'm asking you to change the contents to). Out of curiosity, is the getImage function's contents different than the original version I included in the last post? Because it's quite curious to me how images are being stored and pulled in your setup, but I digress... try the changes, then get back to me?
__________________
Please do not contact me. I cannot offer tech support on any coding I've done prior to 2018.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysidia Sites Directory Hall of Famer Adoptables Sites Showcase 6 08-10-2016 03:28 AM
This is sort of an hypothetical: Collecting things besides adopts and items EzzyAlpha Questions and Supports 8 11-12-2013 07:23 AM
Free linearts for your sites. :> pachoofoosh Art Gallery 4 01-08-2013 06:56 PM
Random breeding outcome/ rare breeding SilverDragonTears Questions and Supports 0 03-25-2012 02:33 AM
Adoptable Sites Directory! Hall of Famer Adoptables Sites Showcase 7 08-29-2011 04:04 AM


All times are GMT -5. The time now is 02:55 PM.

Currently Active Users: 204 (1 members and 203 guests)
Threads: 3,951, Posts: 31,454, Members: 15,543
Welcome to our newest members, Holy.
BER





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636