SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Tools and Files

Reply
 
Thread Tools Display Modes
Old 01/05/2020, 02:55 PM   #1
jasperschellekens
High-roller
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Holland
Posts: 1,167
Reputation: 165
Default Simple Skin Browser HTML & PHP

I made this skin browser and decided to share it as it might be useful for others.
It works extremely simple and kind of self explainationary.

Screenshot:


How to install?
Step 1: Download the images package and extract the skins folder inside your web root folder. (usually www)
Step 2: Create a php file and name it skinbrowser.php
In this file you will paste this code:
PHP Code:
<head>
    <title>Skin Browser</title>
</head>
<div class="row" style="box-sizing: inherit; display: flex; flex-wrap: wrap; margin-right: -15px; margin-left: -15px;">
   <div class="col-lg-12 mb-3" style="box-sizing: inherit; position: relative; width: 1140px; min-height: 1px; padding-right: 15px; padding-left: 15px; -webkit-box-flex: 0; flex: 0 0 100%; max-width: 100%; margin-bottom: 1rem !important;">
      <div class="card" style="box-sizing: inherit; position: relative; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; flex-direction: column; background-color: rgb(255, 255, 255); border: 1px solid rgba(0, 0, 0, 0.125); border-radius: 0.25rem; position: relative;">
        <h1 class="card-header" style="box-sizing: inherit; font-size: 1.4rem; margin: 0px; font-family: inherit; font-weight: 500; line-height: 1.1; color: inherit; padding: 0.75rem 1.25rem; background-color: rgb(247, 247, 249); border-bottom: 1px solid rgba(0, 0, 0, 0.125); border-radius: calc(0.25rem - 1px) calc(0.25rem - 1px) 0px 0px;">
         Skin Browser</h1>
          <div class="limiter">
           <?php
              
if(isset($_GET["skin"])) {
                
$skin $_GET["skin"];
              } else 
$skin 1;
              
$nskin $skin 1;
              
$pskin $skin 1;
              if(
$pskin <= 0$pskin 299;
              elseif(
$pskin == 74$pskin 73;
              if(
$nskin >= 300$pskin 1;
              elseif(
$nskin == 74$nskin 75;
           
?>
           <center><img src="skins/<?php echo $skin?>.png" style="width: 400px; height: 250px;">
            <p><a href = "skinbrowser.php?skin=<?php echo $pskin?>">
              <button class="login100-form-btn">
                 Previous
              </button></a> 
              <a href = "skinbrowser.php?skin=<?php echo $nskin?>">
              <button class="login100-form-btn">
                 Next
              </button></a><br>  
              You are viewing skin with ID <?php echo $skin?>.
            </p>
           </center>
        </div>
      </div>
    </div>
  </div>
</div>
Step 3: Upload the new php file to your root folder. You can now access it on yourwebsite.com/skinbrowser.php.

Optional
The skinbrowser is inteded to work as a pop-up. If you want to use it as a popup too, you can do so like this:
PHP Code:
<a href="http://website.com/skinbrowser.php" onclick="window.open('http://website.com/skinbrowser.php','Skin Browser', 'width=500,height=525,location=no,scrollbars=no,toolbar=no,location=no'); return false">Open Skin Browser</a
Change website.com to your own website url.


You are free to use, edit, reupload this however you like.
__________________
Undead Wasteland Roleplay | Visit website
The year is 1996. San Andreas is a wasteland ruled by the undead. the once so glorius landscape of San Andreas, is now a shattered decayed place that is only a vague memory of the world as we used to know it.
jasperschellekens is offline   Reply With Quote
Old 10/05/2020, 06:13 PM   #2
mihay111
Little Clucker
 
Join Date: Mar 2019
Posts: 1
Reputation: 0
Default Re: Simple Skin Browser HTML & PHP

nice man
mihay111 is offline   Reply With Quote
Old 10/05/2020, 09:48 PM   #3
l0gic
Huge Clucker
 
Join Date: Aug 2019
Posts: 206
Reputation: 59
Default Re: Simple Skin Browser HTML & PHP

this code is bad like really really bad.
loading skins with php is already very slow and out of date.
its better to load only skin and not whole page so javascript is right way.
writing styling into style is also bad, its usally done with css classes.
<center></center> html is out of date.
__________________
Coding experience with: PAWN, Java, Python, Javascript, PHP and SQL for about 6 years.
If I helped you, any reputation would be appreciated.
l0gic is offline   Reply With Quote
Old 10/05/2020, 10:07 PM   #4
l0gic
Huge Clucker
 
Join Date: Aug 2019
Posts: 206
Reputation: 59
Default Re: Simple Skin Browser HTML & PHP

This code is much cleaner and understandable for user to implement and change to his preference.
HTML Code:
<html>

<head>
    <style>
        .skin-box {
            box-sizing: border-box;
            text-align: center;
            width: 200px;
            height: 200px;
        }
        
        .skin-img {
            width: 100%;
            height: 100%;
        }
    </style>
    <script src='https://code.jquery.com/jquery-3.4.1.min.js'></script>
    <script>
        let currentSkin = 0

        $(() => {
            loadSkin()
        })

        function loadSkin() {
            $('#current_skin_img').attr('src', `skins/${currentSkin}.png`)
            $('#current_skin_id').html(`${currentSkin}`)
        }

        function changeSkin(index) {
            let value = currentSkin + index
            if (value < 0 || value > 299) return false
            currentSkin = value
            loadSkin()
            return true
        }
    </script>
</head>

<body>
    <div class='skin-box'>
        <img class='skin-img' id='current_skin_img' src=''>
        <input type='button' onclick='changeSkin(-1)' value='Back'>
        <input type='button' onclick='changeSkin(1)' value='Next'>
        <p>Current skin: <span id='current_skin_id'></span></p>
    </div>
</body>

</html>
__________________
Coding experience with: PAWN, Java, Python, Javascript, PHP and SQL for about 6 years.
If I helped you, any reputation would be appreciated.
l0gic is offline   Reply With Quote
Old 12/05/2020, 08:54 AM   #5
JasonTheMan
Big Clucker
 
JasonTheMan's Avatar
 
Join Date: Apr 2020
Posts: 57
Reputation: 6
Default Re: Simple Skin Browser HTML & PHP

Nice one
__________________
Owner/Founder - DesignUX
New Project - RedWood High
JasonTheMan is offline   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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] OutSkins - Simple skin detection kooltuO Includes 4 26/01/2014 02:26 PM
[FilterScript] Simple yet sophicated skin saving. Blunt Filterscripts 9 11/01/2014 10:29 PM
[FilterScript] Skin selectio menu simple wsstylez Filterscripts 10 10/04/2011 05:17 PM
[HTML]Enter Page: Simple Red saiberfun Everything and Nothing 5 24/11/2009 07:00 PM


All times are GMT. The time now is 10:18 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.