Coder Social home page Coder Social logo

pico_slider's Introduction

pico_slider

Create sliders(image lists) inside the Pico CMS.

Use Cases

This plugin really just reads images and outputs them in an array to be used on the front end. You could use any slider library that you want really. I like Swipe because I just find it to be the best since there is no jQuery required and it works amazingly well on mobile devices.

Installation

  • Clone this repo into your plugins folder.
  • Do not change the name. Leave it as pico_slider.
  • Download Swipe or some other slider lib.
  • Setup the sliders JS and CSS files.
  • Create a folder inside content called images. Path would be {pico_root}/content/images/.
  • Inside that folder, drop all the images you want to use. (structure can be changed, defaut is .jpg images)
  • Add the markup into your theme or mardown file
  • Have fun!

Markup

This is specific to Swipe. You can do whatever you like for your slider library.

<div id="slider" class='swipe'>
  <div class="swipe-wrap">
    {% for image in images %}
      <div class="swipe-slide">
        <img src="{{ image.url }}" alt="{{ image.name }}" width="{{ image.width }}" height="{{ image.height }}">
      </div>
    {% endfor %}
  </div>
</div>

Image properties

Here is what is stored in each image item.

$image = array(
  'name' = 'mylittlepony', // basically just the file name without the extension
  'width' = 900,
  'height' = 600,
  'url' = 'content/image/mylittlepony.jpg' // basically just the base_url + the image url
);

Customizing Paths and Extensions

By default the plugin will only grab .jpg images. This can be changed in the pico_slider.php file.

private $image_path = 'content/images'; // the path to the folder you want to use for loading the images
private $image_ext = '.jpg'; // the extension of the files you are looking for

License

(The MIT License)

Copyright (c) <2013> James Doyle(@james2doyle) [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

pico_slider's People

Contributors

james2doyle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pico_slider's Issues

can´t get it work

Hi,

Hi, i installed the pico_slider plugin, created an images folder with some images inside. so far, so good - easy. But I don´t understand, where to put the php code for the images:

//////////////////////////////////////////////////////////////////

$image = array(
'name' = 'mylittlepony', // basically just the file name without the extension
'width' = 900,
'height' = 600,
'url' = 'content/image/mylittlepony.jpg' // basically just the base_url + the image url
);

//////////////////////////////////////////////////////////////////

Do I have to create a file inside the images folder? or at another place inside the pico_root? what kind of file? .php or .md .. in your pico documentation, there is no info on how to implement images. If i only can use html-tags for images, I don´t understand the whole concept.

I also downloaded swipe, but here i also don´t know, where is the right location for the files. maybe it´s better to give more detailed instructions on how to use it. i get it working easy via hardcoding, but then i don´t understand, why i have to use a plugin. i want to make a website for my girlfriend, she don´t want to see code! :)

Please help! Thanks a lot!

multiple galleries

Is there a way to get the images depending on some subfolder-name ? for example "content/images/party" and "content/images/holiday"

perhaps with the url pics/party and pics/holiday or like this pics?gallery=party (?)

i have added this to the before_render function, but don't know if this is the 'right way':

        //added
        $gallery = $_GET["gallery"];

        if(!empty($gallery)){ 
            $this->image_path = $this->image_path."/".$gallery;
        }else{
            $this->image_path = $this->image_path."/start";
        }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.