Author Topic: [Mod] Image Battle  (Read 11178 times)

0 Members and 1 Guest are viewing this topic.

Rembrandt

  • Guest
[Mod] Image Battle
« on: October 20, 2014, 07:47:48 PM »
This Modification is a Addon for "Mod Allow users to edit their own images and thumbnails"
The Mod Allow users to edit their own images and thumbnails is required.
In ACP/Session and Usersettings Activate "Images Battle Activate".
Each member can share his pictures in the "member_editimage" and "member_uploadimage" as Image Battle.
 
1.) Creating two new table field in the database:
Code: [Select]
ALTER TABLE 4images_images ADD image_battle TINYINT(1) DEFAULT '0' NOT NULL
 ALTER TABLE 4images_images ADD image_update TEXT NOT NULL DEFAULT
Alternatively, copy the file "install_image_battle.php" from the Attachment in your root, login as Admin and call it to.

2.) search in admin/setting.php:

show_setting_row
("user_delete_comments""radio");

insert below:

  show_setting_row
("user_battle""radio");
  
show_setting_row("user_battle_sticky""radio");


3.) search in lang/your lang/admin.php:
(deutsch)

$setting
['user_delete_comments'] = "Dürfen User Kommentare zu Ihren eigenen Bildern löschen";

insert below:

$setting
['user_battle'] = "Bilder \"Battle\" Aktivieren:";
$setting['user_battle_sticky'] = "Freigegebene Bilder zum \"Battle\" zuerst Anzeigen:";

(english)

$setting
['user_battle'] = "Images Battle Activate:";
$setting['user_battle_sticky'] = "Images for Battle ads first:";


4.) search in lang/your lang/main.php "?>" and insert above:
(deutsch)

$lang
['image_battle'] = "Image Battle";
$lang['image_editor'] = "Zuletzt Bearbeitet von:";

(english)

$lang
['image_battle'] = "Image Battle";
$lang['image_editor'] = "Last Edit:";


5.) search in lang/includes/db_field_definitions.php "?>" and insert above:

//######################## Start Mod Image Battle ############### 
$additional_image_fields['image_battle'] = array($lang['image_battle'], "radio"0);
$additional_image_fields['image_editor'] = array($lang['image_editor'], "text"0);
//####################### End Mod Last Modifi   #################


6.) search in categories.php:

    $additional_sql 
.= ", i.".$key;
  }
}

insert below:

//######################## Start Mod Image Battle ##############
$userBattleSticky = ($config['user_battle_sticky']) ? "i.image_battle = 1  DESC, " :"";
//######################## End Mod Image Battle ################

6.1) search:

ORDER BY 
".$config['image_order']." ".$config['image_sort']."i.image_id ".$config['image_sort']."

and replace:

ORDER BY 
".$userBattleSticky."".$config['image_order']." ".$config['image_sort']."i.image_id ".$config['image_sort']."

6.2) search:

$site_template
->register_vars("thumbnails"$thumbnails);

and replace:

  $site_template
->register_vars(array(
  
"thumbnails" => $thumbnails,
  
"image_battle" => ($image_row['image_battle']) ? 1:0,
  ));


7.) search in index.php:

$num_new_images 
$config['image_cells'];

insert above:

//######################## Start Mod Image Battle ##############
$userBattleSticky = ($config['user_battle_sticky']) ? "i.image_battle = 1  DESC, " :"";
//######################## End Mod Image Battle ################

7.2) search:

ORDER BY i
.image_date DESC

and replace:

ORDER BY 
".$userBattleSticky." i.image_date DESC


8.) search in member.php in section "if ($action == "updateimage") {" :

 
if (!$image_row || $image_row['user_id'] <= USER_AWAITING || ($user_info['user_id'] != $image_row['user_id'] && $user_info['user_level'] != ADMIN)) {
    
show_error_page($lang['no_permission']);
    exit;
  }

and replace:

//######################## Start Mod Image Battle ############### 
  
if ($image_row || ($user_info['user_level'] >= USER) || ($image_row['image_battle'] && $config['user_battle'])) {
    
$image_editor $image_row['user_id'];
  }else{
    
$image_editor $user_info['user_id'];
  }
  if (!
$image_row || $image_row['user_id'] <= USER_AWAITING || ($image_editor != $image_row['user_id'] && $user_info['user_level'] != ADMIN)) {
    
show_error_page($lang['no_permission']);
    exit;
  }
//######################## End Mod Image Battle ###############

8.1) search in member.php in section "if ($action == "updateimage") {" :

      $table_fields 
$site_db->get_table_fields(IMAGES_TABLE);
      foreach (
$additional_image_fields as $key => $val) {
        if (isset(
$HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
          
$additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
        }

and replace:

//######################## Start Mod Image Battle ############### 
      
$image_update "".$user_info['user_id'].",".$user_info['user_name'].",".format_date($config['date_format']." ".$config['time_format'], time())."";
//######################## End Mod Image Battle ################# 
      
$table_fields $site_db->get_table_fields(IMAGES_TABLE);
      foreach (
$additional_image_fields as $key => $val) {
        if (isset(
$HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
          
$additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
        }
//######################## Start Mod Image Battle ###############         
        
if($key == 'image_editor'){
          
$additional_sql .= ", image_editor ='".(($image_row['image_editor'] != "") ? $image_update.";".$image_row['image_editor'] : $image_update )."'";
        } 
//######################## End Mod Image Battle #################  

8.2) search in member.php in section "if ($action == "editimage") {":

$txt_clickstream 
get_category_path($image_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" class=\"clickstream\">".format_text($image_row['image_name'], 2)."</a>".$config['category_separator'];

insert above:

//######################## Start Mod Image Battle ############### 
  
if ($image_row || ($user_info['user_level'] >= USER) && ($image_row['image_battle'] || $config['user_battle'])) {
    
$image_editor $image_row['user_id'];
  }else{
    
$image_editor $user_info['user_id'];
  }
  if (!
$image_row || $image_row['user_id'] <= USER_AWAITING || ($image_editor != $image_row['user_id'] && $user_info['user_level'] != ADMIN)) {
    
redirect($url);
  }
//######################## End Mod Image Battle ################# 

8.3) search in member.php in section "if ($action == "editimage") {":

"edit_imagethumb" => ($config['user_edit_imagethumb']) ? 1:0,

insert above:

"image_owner" => ($config['user_battle'])?(($user_info['user_id'] == $image_row['user_id']) ? :""):"",

8.4) search in member.php in section "if ($action == "uploadform") {" :

  $site_template
->register_vars(array(   
    
"cat_id" => $cat_id,

and replace:

  $site_template
->register_vars(array(
//######################## Start Mod Image Battle ###############
    
"user_battle" => ($config['user_battle'] ? 1:""),
//######################## End Mod Image Battle ###############    
    
"cat_id" => $cat_id,


9.) serach in details.php:

elseif ($is_image_owner) {
  
$admin_links .= ($config['user_edit_image'] != 1) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editimage&amp;".URL_IMAGE_ID."=".$image_id)."\">".$lang['edit']."</a>&nbsp;";

and replace:

elseif ($is_image_owner || (($user_info['user_level'] >= USER) && ($image_row['image_battle'] && $config['user_battle']))) { //########## image_battle ###########
  
$admin_links .= ($config['user_edit_image'] != 1) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editimage&amp;".URL_IMAGE_ID."=".$image_id)."\">".$lang['edit']."</a>&nbsp;";

9.1) search:

//-----------------------------------------------------
//--- Print Out ---------------------------------------

insert above:

//################### Start Mod image_battle #####################
if(($image_row['image_editor'] !='') || ($config['user_battle'])){
  
$imageUpdateArray explode(";",$image_row['image_editor']);
  
$imageLastEditor =  explode(",",$imageUpdateArray[0]);
  
$imageEditor =  "<select class= \"imageEditor\" name=\"imageEditor\" onChange=\"window.location.href=this.value\">";
  
$user_link ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$imageLastEditor[0];
  
$imageEditor .= "<option value=\"".$site_sess->url($user_link)."\">".$imageLastEditor[1]." am ".$imageLastEditor[2]."</option>";
  foreach (
$imageUpdateArray as $key => $val) {
    
$val explode(","$imageUpdateArray[$key]);
    
$user_profile_link[$key] = ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$val[0];
    
$imageEditor .= "<option value=\"".$site_sess->url($user_profile_link[$key])."\">".$val[1]." am ".$val[2]."</option>";
  }
  
$imageEditor .= "</select>";
}

  
$site_template->register_vars(array(
  
"image_battle" =>  ($config['user_battle']) ? $image_row['image_battle'] :"",
    
"lang_image_editor" => $lang['image_editor'],
    
"image_editor" =>  $imageEditor
  
));


10.) search in your templates/details.html:
Code: [Select]
 <td valign="top" class="row2">{user_name_link}</td>
</tr>
insert below:
Code: [Select]
{if image_battle}
<tr>
  <td valign="top" class="row1"><b>{lang_image_editor}</b></td>
  <td valign="top" class="row1">{image_editor}</td>
</tr>
{endif image_battle}

11.) search in your templates/member_editimage.html:
Code: [Select]
             <textarea name="image_keywords" cols="30" rows="10" wrap="virtual" class="textarea">{image_keywords}</textarea>
            </td>
          </tr>
insert below:
Code: [Select]
         {if image_owner}
           <tr>
            <td class="row1"><b>{lang_image_battle}</b></td>
            <td class="row1">
              <input type="radio" name="image_battle" value="1" {image_battle_yes} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="image_battle" value="0" {image_battle_no} />
              {lang_no}</td>
          </tr>
          {endif image_owner}

12.) search in your templates/member_uploadform.html:
Code: [Select]
             <textarea cols="30" class="textarea" rows="10" name="image_keywords">{image_keywords}</textarea>
            </td>
          </tr>
insert below:
Code: [Select]
         {if user_battle}
          <tr>
            <td class="row1"><b>{lang_image_battle}</b></td>
            <td class="row1">
              <input type="radio" name="image_battle" value="1" {image_battle_no} />
              {lang_yes}&nbsp;&nbsp;&nbsp;
              <input type="radio" name="image_battle" value="0" {image_battle_yes} />
              {lang_no}</td>
          </tr>
          {endif user_battle}

13.)search in your template/thumbnail_bit.html and insert where ever you want:
Code: [Select]
{if image_battle}<sup class="imageBattle">{lang_image_battle}</sup>{endif image_battle}

14.) search in your templates/style.css "?>" and insert above:
Code: [Select]
.imageEditor{
  border:0 outset;
  background-color: #E5E5E5;
  font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
  color: #0f5475;
  font-size: 11px;
  width: 200px;
}

.imageBattle {
  font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
  font-size: 11px;
  color: Green;
}

mfg Andi
« Last Edit: October 20, 2014, 08:05:41 PM by Rembrandt »

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: [Mod] Image Battle
« Reply #1 on: October 23, 2014, 09:16:43 AM »
Guten morgen Andi!

Vielen Dank dass du dich dem MOD angenommen hast und sorry, dass er doch ziemlich groß geworden ist.
Bin leider  zeitlich noch nicht dazu gekommen ihn einzubauen. Werde ich aber hoffentlich bald machen können!
Dir noch einen schöne Tag und vielen dank nochmals,
bergblume

Rembrandt

  • Guest
Re: [Mod] Image Battle
« Reply #2 on: October 23, 2014, 12:45:20 PM »
... dass er doch ziemlich groß geworden ist.
...
Das habe ich mir auch gedacht, welch ein Monster, ist aber halb so Wild.
Das meiste betrifft die Anzeige in den Thumbnails und auf der Detailseite.

mfg Andi

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [Mod] Image Battle
« Reply #3 on: October 27, 2014, 06:52:46 AM »
hast du ein Demo davon?

Rembrandt

  • Guest
Re: [Mod] Image Battle
« Reply #4 on: October 27, 2014, 06:56:19 AM »
hast du ein Demo davon?
Ja, da es nur als angemeldeter User funktioniert musst dich Registrieren
Im ACP ist "Bilder "Battle" Aktivieren" und "Freigegebene Bilder zum "Battle" zuerst Anzeigen" Aktiviert (eh klar) :)

mfg Andi

Offline .Infecto

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: [Mod] Image Battle
« Reply #5 on: June 17, 2015, 02:28:12 AM »
Was genau macht dieser Mod?
Ich suche ein Mod, mit dem man Bilder gegenüberstellen kann und bewerten kann.
So wie hier:


Hast du da auch etwas parat für?

Die Bilder sollen durch Zufall angezeigt werden.
Mittels klick auf "vote" soll das Bild in "%" gewertet werden und es sollen direkt die nächsten Bilder geladen werden.

LG

Rembrandt

  • Guest
Re: [Mod] Image Battle
« Reply #6 on: June 17, 2015, 03:59:54 PM »
Was genau macht dieser Mod?...
ein User stellt ein Bild ein, der nächste bearbeitet es und stellt es wieder ein, dann der nächste u.s.w.....
Erklärung und Diskussion dazu hier:
http://www.4homepages.de/forum/index.php?topic=30978.msg165618#msg165618

Das von dir gewünschte gibt es nicht.

Offline .Infecto

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: [Mod] Image Battle
« Reply #7 on: June 18, 2015, 02:55:21 AM »
Danke für die Info.
Leider kann ich das so nicht verwenden.

Das von mir gewünschte, würde soetwas in der richtung von dir kommen ?

LG