Jump to content

Request for improved skin/add-on compatibility


• Jay •

Recommended Posts

Many add-ons come with their own custom images, and those files have to be uploaded separately to each skin after they are installed.

It would make life easier if skins could automatically be modified to use the images from those add-ons upon installation and the add-on installation process itself also make references to those images in existing skins besides just the master.

Come to think of it, quite a few of the default skin images have to be copied over (especially images for the notifications page).

To illustrate, here is a zip file of the images I typically have to upload whenever I install a new skin.

Typical Missing Skin Images.zip

Link to comment
Share on other sites

An add-on has ( or should have ) it's own image folder regardless of skin. There should never be a need to upload images to each skin. That was the old way under IP.Board 2.X. If you have to upload add-on mod images when you install new skins, the add-on was poorly made.

Where I store my application images, and I think the best place for compatibility is /public/appname/images/ where they are available for all skins.

We used to store them in /admin/application_addon/other/appname/sources/images/ but ran into problems when people wanted to rename their admin folder.

Link to comment
Share on other sites

If you have to upload add-on mod images when you install new skins, the add-on was poorly made.



Believe me, I agree. But they're out there. I use a few of them, myself (including shoutbox, no less!)



We used to store them in /admin/application_addon/other/appname/sources/images/ but ran into problems when people wanted to rename their admin folder.



The rest of the board files are able to adapt to a renamed admin folder, why not use the same %admin% style link to refer to the directory instead of the static /admin/etc format?
Link to comment
Share on other sites


Believe me, I agree. But they're out there. I use a few of them, myself (including shoutbox, no less!)




The rest of the board files are able to adapt to a renamed admin folder, why not use the same %admin% style link to refer to the directory instead of the static /admin/etc format?




I would assume the add-ons are checked ( at least here ) before they are approved. So if they require images uploaded to each skin folder, then who ever approves the mod had dropped the ball.

For images, because it is easier to use /public/appname/ and they are for the public side anyway.
Link to comment
Share on other sites

I don't know about Suscription Manager, but Shoutbox image does not need to be uploaded to all skin folders: only the master folder. It would be senseless to upload the same image to all skin folders when it can always be found in the master.

Link to comment
Share on other sites

The reason it is common practice to code applications this way is that the same images do not always look correct on the same skins. Third party apps are always written to look right on the IP.Board default skin, but on different skins (especially dark ones) you might see weird borders show up or other graphical glitches with image files that look perfect on the default skin. In addition, some sites will design skins where they want a very consistent color scheme, so they may want a red version of an app's blue icon in that skin, but the standard icon in another. By just having a single 'this is my app's image folder' folder, you break this functionality.

No one 'dropped the ball' by approving apps that do it this way, if that was the case then every addon for IP.Board that IPS created shouldn't have been approved either.

Link to comment
Share on other sites

We used to store them in /admin/application_addon/other/appname/sources/images/ but ran into problems when people wanted to rename their admin folder.


The rest of the board files are able to adapt to a renamed admin folder, why not use the same %admin% style link to refer to the directory instead of the static /admin/etc format?



Having the images in the admin folder of the app (with the url visible to everyone) would totally defeat the purpose of renaming the admin folder to hide it... :ninja:
Link to comment
Share on other sites


The reason it is common practice to code applications this way is that the same images do not always look correct on the same skins. Third party apps are always written to look right on the IP.Board default skin, but on different skins (especially dark ones) you might see weird borders show up or other graphical glitches with image files that look perfect on the default skin. In addition, some sites will design skins where they want a very consistent color scheme, so they may want a red version of an app's blue icon in that skin, but the standard icon in another. By just having a single 'this is my app's image folder' folder, you break this functionality.



No one 'dropped the ball' by approving apps that do it this way, if that was the case then every addon for IP.Board that IPS created shouldn't have been approved either.




How do you figure it will break functionality? Only the mod will use folder /public/appname/images/ regardless of skin, same as using the skin master.

The only possible way is if IPS changes /public/ to something else not compatible with {$this->settings['public_dir']}, but then lots of mods will break anyhow.

btw the dropping the ball comment meant if a mod requires adding an identical image to all skins, instead of just the master.
Link to comment
Share on other sites

I created an install routine in one of my hooks to place some icons in every skin folder automatically, though it probably won't work for every server setup.

It is possible.

<?

/**

 * Plant notification images when installing the hook.

 * © 2012 Ryan Hoerr / Sublime Development

 * http://www.sublimism.com

 */


class sldModNotifications

{

    private $images    = array(

        'notify_arrow_right.png' =>  'eJwBVAGr/olQTkcNChoKAAAADUlIRFIAAAAQAAAAEAgGAAAAH/P/YQAAAAlwSFlzAAALEwAACxMB

                                      AJqcGAAAAQZJREFUOMvtUz9LA3EMfQdFpKNOJ4KCFNHBjopUcBInv4GLU90c/BCObrr0ewgiXRUX

                                      FcQ/V6k42rXS++UlFwevpwWHagcXHwRCwkseeSRyd4yCEkbE3w+Auw8dW8cbp5uH62Nfaz9SIKnU

                                      Qk9uAVT6tcjdsX9edwAwGpQKikICISkhqSCkAkkF8UQMEeIheby5PLiuDtxgdXINlhk00yJoBhrB

                                      jKAp1BQ0Rbf7trSwW7m4O0qWS/3NNH6STcFMc7KCmg/Ie0KCoiwUKBXN57NvZYfeR14eLyOOp9B5

                                      7SC5f7pqNdq14gbDoLq3uCKBTYq+tBrt+V/ZOLczezKzPT1gY/T/C3gHuGQMQaiwjqoAAAAASUVO

                                      RK5CYII44YLq',

        'notify_lock.png' =>          'eJwB2QIm/YlQTkcNChoKAAAADUlIRFIAAAAQAAAAEAgGAAAAH/P/YQAAAAlwSFlzAAALEwAACxMB

                                      AJqcGAAAAotJREFUOMtlks1rXGUUxn/3ziSTGfMx9ivkKulMM7RCQcVd6qJQ1IUUBNGdG3FRhAay

                                      KVkG4jL/hIsJ0kXd9g8Q4qalQdu0xKaXMSiUFDPJJLmZ+54PF7dpJ+2BAwfOeX88z8MbuTuDtbKy

                                      Mmpmt1R1VlVPqSqq+p+q/i4iy/Pz8/uD99EgoN1uf2xmvyZJ0pyYmCCOY8yMLMvY3t4mTdNUVb9e

                                      WFhYewvQbrdHVfXBzMxMK89ztra2ODg4QFUpl8tMTk4CsL6+/lRVP1xcXMwAysckVf1xamqqFUJg

                                      Y2PjmYhcU9V/VZUsy5Jut7vabDaTJElaaZreBJZPAERktlarsbm5SQjh+tzcXGfAamdpaemzTqez

                                      3mg0EJHZ48Ug4Gwcx/R6PUQk5Y0SkTSEQBzHqOrZExn8/dv3vrp5iee7VVSVry7fo+QBV8Gl6BCU

                                      n9c+wcyYHNnh+nv3uHTjQVQocOfbb64REROVqkR8CRZBeQRw0IBKj5++2AcLADz9ZfW1BVcBHHlx

                                      m3LlDFE0CjYE1Tq4weEuuvcXefYPJodUmzfxvD8AEAFz0Jzuw/vE8TvUL19h6+4ybueYvvo53ceP

                                      yLMdxhrv4q54yAcBAdxwDdQ/uEg8fAYiQ/vKHy+qTJNTbzU52q/gcljcngCEgLuCBnb+XKNUGaf+

                                      0afYkdHP+uA53SePOTrcZfx8HczwICcBhYKc+sUGpdppiHMufHeDC0Fg7zkTrYTh3aFCgXnx5jUg

                                      BzNMcroPH1GqjcHIKJSHwQT2umQ724SDHmPT4zhW2B4EuCuV93+ger5ENFyBchXiITCFPGMs20ND

                                      HzcF9yL4V4C8z7M7t4osRHAJL/t4VlAtPpa+nE0B+B9k9KxgOBC4kQAAAABJRU5ErkJggm+0Uz0=' );

    private $dir    = '../public/style_images';

    private $subd    = '/notifications';

    private $skins    = array();


    public function install()

    {

        $this->findSkins();


        // Insert notification images in each skin folder.

        foreach($this->skins as $skin) {

            $cd = $this->dir . '/' . $skin . $this->subd;

            @mkdir( $cd );


            foreach($this->images as $image => $data) {

                @file_put_contents( $cd . '/' . $image, gzuncompress( base64_decode( $data ) ) );

            }

        }

    }


    public function uninstall()

    {

        $this->findSkins();


        // Remove the images from each folder.

        foreach($this->skins as $skin) {

            foreach($this->images as $image => $data) {

                @unlink( $this->dir . '/' . $skin . $this->subd . '/' . $image );

            }

        }

    }


    protected function findSkins()

    {

        // Find skin image folders.

        $style_images = scandir($this->dir);

        foreach($style_images as $item) {

            if( is_dir($this->dir . '/' . $item) && $item != '.' && $item != '..' )

                $this->skins[] = $item;

        }

    }

}



The code is free for use, by the way--I'd just appreciate some form of attribution if you do.

Link to comment
Share on other sites


How do you figure it will break functionality? Only the mod will use folder /public/appname/images/ regardless of skin, same as using the skin master.



The only possible way is if IPS changes /public/ to something else not compatible with {$this->settings['public_dir']}, but then lots of mods will break anyhow.



btw the dropping the ball comment meant if a mod requires adding an identical image to all skins, instead of just the master.




The functionality described in my post is what will break: the ability to define different icons for different skins. Your method is easier, yes, but it locks anyone who uses such a mod into always using the same icon for each skin, and that simply won't work for every forum owner.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...