Topic: [NB 1.9] Images Categories

Uploads the images in the following path : images/CATEGORIE_NAME
It also automaticly create the sub directories


http://chevereto.com/2.0/images/9d3m1.png

Modifications :

open index.php

find

    <div id="redimensionar">
        <div id="redimensionar_cajatitulo">
            <div id="redimensionar_titulo">
                <div id="boton_redimensionar"<?php if (isset($lang)) { echo ' class="'.$lang.'"'; } ?>><span><a id="rclosed"></a><a id="ropen" style="display: none;"></a></span></div>
                <div id="red_mensaje"><span id="red1"><?php echo RESIZE_DSC;?></span><span id="red2" style="display: none;"></span></div>
            </div>
        </div>        
        <div id="redimensionar-borde" style="display: none;">
            <div id="cajonred">
                <div id="ancho_deseado"><?php echo RESIZE_WIDTH;?> <span><?php echo RESIZE_PIXELS;?></span></div>
                <input name="resize" id="resize"/>
                <div id="kepp"><?php echo RESIZE_KEEP;?></div>
            </div>
        </div>
    </div>

add after

        <div style="text-align: center;">
            <h5> Categories </h5>
        
            <select name="categories">
            <?php
                foreach ($categories as $key=>$value)
                {
                    print('<option value="'.$key.'" />'.$value);
                }
            ?>
            </select>
        </div>

open config.php

find :

$allow_over_resize = false; // true: Allows over resize images - false: Don't allow over resize.

** 'FOLDER_NAME' => 'Name that appears on the dropdown',

add after

// ALL NAMES MUST ONLY CONTAINS ALPHA NUMERICS CARACTERS OR SPACES
$categories = array (
                        '' => 'No Categories',
                        'Diablo III' => 'Diablo III',
                        'WoW' => 'World of Warcraft',
                        'FF13' => 'Final Fantasty 13',
                        'COD6' => 'Call of Duty: Black Ops'
                    );

open engine.php

find

require('config.php');

add after

foreach($categories as $name=>$dir)
{
    if (!file_exists(DIR_IM.$name))
    {
        mkdir(DIR_IM.$name, 0777);
    }
    
    if (!file_exists(DIR_TH.$name))
    {
        mkdir(DIR_TH.$name, 0777);
    }
}

find

            if (empty($resize)) {
                // Haga como si nada...
                copy($handlework, DIR_IM.$name);
                $titulo = UPLOAD_OK.ESP_TITULO;
            }

add before

            if (isset($_POST['categories']) && !empty($_POST['categories']))
            {
                $name = $_POST['categories'].'/'.$name;
            }

Last edited by Danny.Domb (2011-05-26 10:27:03)

~ Sup?!

Thumbs up

Re: [NB 1.9] Images Categories

omg , great job danny, i ll add the mod now to my site.

tyvm.

Thumbs up

Re: [NB 1.9] Images Categories

modification needed for cheverto 2.0

Thumbs up