about a custom fields for image description about a custom fields for image description
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

about a custom fields for image description

Started by MaK_86, July 26, 2011, 07:41:17 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

MaK_86

Greating...

I often wonder, if it's possible to make a custom fields for image description like a list from you can choose.
You can make something like a 30 options to bee on the list, and later when uploading a picture, you can select what you mean.

I have a railway photo gallery, so I've thought to make a description like this whith a railway industries.

Hearings...

Αndré

#1
Open edit_one_pic.php, find
if ($CONFIG['user_field1_name'] != '') {

    echo <<< EOT

    <tr>
        <td class="tableb" style="white-space: nowrap;">
            {$CONFIG['user_field1_name']}
        </td>
        <td width="100%" class="tableb" valign="top">
            <input type="text" style="width: 100%" name="user1" maxlength="255" value="{$CURRENT_PIC['user1']}" class="textinput" />
        </td>
    </tr>
EOT;
}

and replace with
if ($CONFIG['user_field1_name'] != '') {

    $options_array = array('', 'TABOR ELEKTRYCZNY', 'TABOR SPALINOWY', 'TABOR PAROWY');
    foreach ($options_array as $option) {
        $selected = $CURRENT_PIC['user1'] == $option ? ' selected' : '';
        $options .= "<option{$selected}>{$option}</option>";
    }

    echo <<< EOT

    <tr>
        <td class="tableb" style="white-space: nowrap;">
            {$CONFIG['user_field1_name']}
        </td>
        <td width="100%" class="tableb" valign="top">
            <select name="user1" maxlength="255" class="listbox">{$options}</select>
        </td>
    </tr>
EOT;
}

MG

This works great for me. However, is it possible to add this function to "Upload"?
I would like to be able to enter this function when adding a new file as well and be able to choose this custom fields..

all the best
MG
Forum Vbulletin 4.1.11  / Portal vBadvanced CMPS v4.2.0, bridged with CPG 1.5.46, cpmfetch 2.0.0

Αndré

Open upload.php, find
text_box_input($element[0], $element[1], $element[3], $element[4], (isset($element[5])) ? $element[5] : '');
and above, add
                    if ($element[1] == 'user1') {
                        $options_array = array('', 'TABOR ELEKTRYCZNY', 'TABOR SPALINOWY', 'TABOR PAROWY');
                        foreach ($options_array as $option) {
                            $selected = $CURRENT_PIC['user1'] == $option ? ' selected' : '';
                            $options .= "<option{$selected}>{$option}</option>";
                        }

                        echo <<< EOT

                        <tr>
                            <td class="tableb" style="white-space: nowrap;">
                                {$CONFIG['user_field1_name']}
                            </td>
                            <td width="100%" class="tableb" valign="top">
                                <select name="user1" maxlength="255" class="listbox">{$options}</select>
                            </td>
                        </tr>
EOT;
                        break;
                    }

MG

Works great when I use upload option "Simple - one file at a time" Αndré, Thank you so much.

BTW
I'll try to call this funcion in (html5upload): v1.3.6 mod.

In codebase.php from this mod. I find this line:

if ($cfg['enabusr1'] && !empty($CONFIG['user_field1_name'])) {
echo '<tr><td class="tableb">'.$CONFIG['user_field1_name'].'</td><td class="tableb"><input type="text" name="user1" id="user1" class="textinput" maxlength="255" style="width:90%" /></td></tr>';
}


and replace to this (copy from edit_one_pic.php) :

if ($CONFIG['user_field1_name'] != '') {

    $options_array = array('Wybierz Typ', 'Poster', 'Render', 'Title Treatment', 'Studio Template', 'Stock Image', 'PSD', 'Brush', 'Logo', 'Action', 'Style');
    foreach ($options_array as $option) {
        $selected = $CURRENT_PIC['user1'] == $option ? ' selected' : '';
        $options .= "<option{$selected}>{$option}</option>";
    }

    echo <<< EOT

    <tr>
        <td class="tableb" style="white-space: nowrap;">
            {$CONFIG['user_field1_name']}
        </td>
        <td width="100%" class="tableb" valign="top">
            <select name="user1" maxlength="255" class="listbox">{$options}</select>
        </td>
    </tr>
EOT;
}


I managed to call the drop down list of custom fields, I can choose an option that suits me. However, when I add files and I will be moved to the next page (editpics.php?album =) in places where the name should appear from custom fields, there is nothing. There is an empty table. What could I do wrong?

Additionally, it may be possible to add a drop down list of custom fields when editing files on the page (editpics.php?album =).
Forum Vbulletin 4.1.11  / Portal vBadvanced CMPS v4.2.0, bridged with CPG 1.5.46, cpmfetch 2.0.0

Αndré

Sorry, but I never used that plugin and won't put any effort into having a closer look at the plugin code. The main difference I can see is, that the input tag contains
id="user1"
while the select tag in your modification doesn't. Try to add it, maybe it already solves your issue.

MG

Works great now Αndré, thank you so much  :)
Forum Vbulletin 4.1.11  / Portal vBadvanced CMPS v4.2.0, bridged with CPG 1.5.46, cpmfetch 2.0.0