Advanced search  

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

Pages: [1]   Go Down

Author Topic: about a custom fields for image description  (Read 9042 times)

0 Members and 1 Guest are viewing this topic.

MaK_86

  • Coppermine newbie
  • Country: pl
  • Offline Offline
  • Gender: Male
  • Posts: 5
about a custom fields for image description
« on: July 26, 2011, 07:41:17 pm »

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é

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: about a custom fields for image description
« Reply #1 on: July 27, 2011, 10:02:57 am »

Open edit_one_pic.php, find
Code: [Select]
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
Code: [Select]
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;
}
« Last Edit: July 27, 2011, 10:08:28 am by Αndré »
Logged

MG

  • Contributor
  • Coppermine newbie
  • ***
  • Country: pl
  • Offline Offline
  • Gender: Male
  • Posts: 12
    • om
Re: about a custom fields for image description
« Reply #2 on: January 05, 2019, 04:07:52 pm »

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
Logged
Forum Vbulletin 4.1.11  / Portal vBadvanced CMPS v4.2.0, bridged with CPG 1.5.46, cpmfetch 2.0.0

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: about a custom fields for image description
« Reply #3 on: January 13, 2019, 10:15:13 pm »

Open upload.php, find
Code: [Select]
text_box_input($element[0], $element[1], $element[3], $element[4], (isset($element[5])) ? $element[5] : '');and above, add
Code: [Select]
                    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;
                    }
Logged

MG

  • Contributor
  • Coppermine newbie
  • ***
  • Country: pl
  • Offline Offline
  • Gender: Male
  • Posts: 12
    • om
Re: about a custom fields for image description
« Reply #4 on: January 14, 2019, 09:44:21 pm »

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:

Code: [Select]
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) :

Code: [Select]
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 =).
Logged
Forum Vbulletin 4.1.11  / Portal vBadvanced CMPS v4.2.0, bridged with CPG 1.5.46, cpmfetch 2.0.0

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: about a custom fields for image description
« Reply #5 on: March 14, 2019, 09:36:34 pm »

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
Code: [Select]
id="user1"while the select tag in your modification doesn't. Try to add it, maybe it already solves your issue.
Logged

MG

  • Contributor
  • Coppermine newbie
  • ***
  • Country: pl
  • Offline Offline
  • Gender: Male
  • Posts: 12
    • om
Re: about a custom fields for image description
« Reply #6 on: March 19, 2019, 05:03:01 pm »

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

Page created in 0.021 seconds with 19 queries.