4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: jotabonfim on August 07, 2009, 12:54:46 AM

Title: [MOD] Latest 5 videos on Home-Site
Post by: jotabonfim on August 07, 2009, 12:54:46 AM
Hi good evening, I would like to know how to select which showed in the last 5 home videos sent to the site.

Example: Select from where image_media_file = .flv

I want to display the thumb and the video link to view it.

Somebody could help me please!
Title: Re: Mod request (View the latest 5 videos Site)
Post by: Rembrandt on August 07, 2009, 07:21:36 AM
Hi!
an arbitrary number of files (e.g. jpg,flv) displayed in home.html:

search in index.php:

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

add before:

//################################# Start Custom Images ###################################################
$file_ext = "flv";//   < < <   write your file extension here  e.g.  "jpg" or "mp3"< < <
$num_new_images = "5";  //< < < how many images to be displayed < < <
$custom_sort = "i.image_date";  //< < < how order? e.g. " i.image_rating, i.image_hits, i.image_votes, i.image_downloads,,i.image_date"< < <

$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.$file_ext'
        ORDER BY $custom_sort DESC
        LIMIT $num_new_images";
$result = $site_db->query($sql);
$num_rows2 = $site_db->get_numrows($result);

if (!$num_rows2)  {
  $new_images2 = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $new_images2 .= $lang['no_new_images'];
  $new_images2 .= "</td></tr></table>";
}
else  {
  $new_images2 = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  $count = 0;
  $bgcounter = 0;
  while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $new_images2 .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $new_images2 .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($image_row);
    $new_images2 .= $site_template->parse_template("thumbnail_bit");
    $new_images2 .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $new_images2 .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($num_new_images - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $new_images2 .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $new_images2 .= "</tr>\n";
    }
  }
  $new_images2 .= "</table>\n";
} // end else

$site_template->register_vars("custom_images", $new_images2);
unset($new_images2);
//################################# End Custom Images ###################################################


at the top of code put the file extension, how many images to displayed, and how sort by.

write in your home.html {custom_images}

mfg Andi
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: mawenzi on August 07, 2009, 10:22:40 AM
... danke Andi ...
... da die Modifikation auch sinngemäß für andere Dateitypen verwendet werden kann und so nicht im Request-Forum versauern soll ...
... Titel geändert und verschoben nach "Mods & Plugins (Releases & Support)" ...
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: jotabonfim on August 07, 2009, 02:59:34 PM
Rembrandt thank you for your help!
 :lol: :D

Excellent module for use on site

I Love 4images
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: yellows on September 17, 2009, 10:32:16 PM
could you make this randomized like the new images mod ?
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Rembrandt on September 18, 2009, 05:44:36 AM
Hi!
could you make this randomized like the new images mod ?
sure, replace:
ORDER BY i.image_date DESC


with this:
ORDER BY RAND()



mfg Andi
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: ahsancharming on October 08, 2009, 01:20:15 PM
this works superbly..
thx alot once again. i luv 4images and through this forum my hopes come true :) now i have my gallery as i was imagining :)
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: GaYan on January 15, 2010, 05:08:24 AM
cant w shot the latest media files from a category on index page ?
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Rembrandt on January 15, 2010, 05:27:47 AM
cant w shot the latest media files from a category on index page ?

search in the code:

$custom_sort = "i.image_date";

insert below:

$cat_in = array(1,2,9,17); // your Cat ID's


search in the code:

 WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.$file_ext'


replace:

 WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id IN (".implode(", ",$cat_in).") AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.$file_ext'

Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: GaYan on January 15, 2010, 05:33:25 AM
Thanks .. thanks for the quick reply sir.. it works great  :wink:
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: hongoctrien on January 22, 2010, 07:59:31 AM
I used mod video, I want show new video (I add video from youtube)?
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Rembrandt on January 22, 2010, 10:59:19 AM
I used mod video, I want show new video (I add video from youtube)?
look on the top of the code:
$file_ext = "flv";//   < < <   write your file extension here  e.g.  "jpg" or "mp3"< < <
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Bommel on January 22, 2010, 12:21:14 PM
Hallo allerseits,

ist es möglich in dieser Zeile:

Code: [Select]
$file_ext = "flv";//   < < <   write your file extension here  e.g.  "jpg" or "mp3"< < <
mehr als eine Endung für Videos anzugeben? Wie müssen diese getrennt werden?

Freundliche Grüße, Bommel
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: hongoctrien on January 22, 2010, 04:07:48 PM
I used mod video, I want show new video (I add video from youtube)?
look on the top of the code:
$file_ext = "flv";//   < < <   write your file extension here  e.g.  "jpg" or "mp3"< < <


I was replace flv by youtube but I don't see it
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: GaYan on January 22, 2010, 08:52:29 PM
how to select all the file formats

Code: [Select]
$file_ext = "*";//   < < <   write your file extension here  e.g.  "jpg" or "mp3"< < <
i have a doubt bout this when using the mod media sites... its great if we can select ll the file extensions t once* .. thanks !
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: hongoctrien on January 23, 2010, 12:15:24 AM
I had insert show for all format, this I want only video (youtube)
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Rembrandt on January 23, 2010, 06:04:47 AM
...
...mehr als eine Endung für Videos anzugeben? ...
am einfachsten ist es wenn du in der SQL das:
Code: [Select]
AND image_media_file LIKE '%.wmv' hinten drann hängst.

how to select all the file formats ...
Code: [Select]
$file_ext = "%";
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Bommel on January 23, 2010, 06:22:02 AM
Hallo Rembrandt,

danke für deine Antwort. :)

Also wenn ich als Anfänger das richtig verstanden habe, so muss ich in diesem Script:

//################################# Start Custom Images ###################################################
$file_ext = "flv";//   < < <   write your file extension here  e.g.  "jpg" or "mp3"< < <
$num_new_images = "5";  //< < < how many images to be displayed < < <
$custom_sort = "i.image_date";  //< < < how order? e.g. " i.image_rating, i.image_hits, i.image_votes, i.image_downloads,,i.image_date"< < <

$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.$file_ext'
        ORDER BY $custom_sort DESC
        LIMIT $num_new_images";
$result = $site_db->query($sql);
$num_rows2 = $site_db->get_numrows($result);

if (!$num_rows2)  {
  $new_images2 = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $new_images2 .= $lang['no_new_images'];
  $new_images2 .= "</td></tr></table>";
}
else  {
  $new_images2 = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  $count = 0;
  $bgcounter = 0;
  while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $new_images2 .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $new_images2 .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($image_row);
    $new_images2 .= $site_template->parse_template("thumbnail_bit");
    $new_images2 .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $new_images2 .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($num_new_images - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $new_images2 .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $new_images2 .= "</tr>\n";
    }
  }
  $new_images2 .= "</table>\n";
} // end else

$site_template->register_vars("custom_images", $new_images2);
unset($new_images2);
//################################# End Custom Images ###################################################

anstelle von:

        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.$file_ext'

diese Änderung einfügen:

        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.wmv'

oder etwa so:

        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.$file_ext' AND image_media_file LIKE '%.wmv'

Sorry, aber ich muss mich da erst reinfinden.

Freundliche Grüße, Bommel
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Rembrandt on January 23, 2010, 06:28:49 AM
      
Code: [Select]
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.$file_ext' AND image_media_file LIKE '%.wmv'oder so
  
Code: [Select]
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.avi' AND image_media_file LIKE '%.wmv' OR image_media_file LIKE '%.flv'
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Bommel on January 23, 2010, 06:38:07 AM
Hallo Rembrandt,

besten Dank. :)

In der Zwischenzeit habe ich endlich auch eine Antwort auf eine Darstellungsform für PHP hier gefunden. War schon drauf und dran dir diese Frage zu stellen.

Das hier sieht viel übersichtlicher aus:
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.$file_ext' AND image_media_file LIKE '%.wmv'

als das:
Code: [Select]
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.$file_ext' AND image_media_file LIKE '%.wmv'
Freundliche Grüße, Bommel
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Rembrandt on January 23, 2010, 06:53:41 AM
sry, habe gerade gesehn das,das so nicht funktioniert..ich werde mir das ansehn...

versuche mal anstatt:
Code: [Select]
AND image_media_file LIKE '%.$file_ext' AND image_media_file LIKE '%.wmv'
das:
Code: [Select]
AND ((image_media_file LIKE '%.flv') OR (image_media_file LIKE '%.wmv'))
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Bommel on January 23, 2010, 12:00:53 PM
Hallo Rembrandt,

der Eintrag:

AND ((image_media_file LIKE '%.flv') OR (image_media_file LIKE '%.wmv') OR (image_media_file LIKE '%.avi'))

funktioniert bei mir bestens. Vielen Dank. Jetzt möchte ich nur noch erreichen, dass im Standard-Script für die neuesten Bilder, die Videos ausgeblendet werden. Denn dort werden mir natürlich auch die Videos angezeigt.

Weiterhin besteht bei mir das Problem, dass Firefox die Videos nicht mit dem Windows-Media-Player abspielt. Wenn ich mich recht erinnere, dann liegt das wohl an diesem ActiveX von Microsoft. Kannst du mir einen Player empfehlen, der in allen gängigen Browsern funktioniert und auch die gängigsten Standard-Formate abspielen kann!

Freundliche Grüße, Bommel

Nachtrag:

Hallo Rembrandt,

im Grunde genommen dürfte das Ausfiltern der Videos relativ einfach sein. Korrigiere mich bitte, wenn ich falsch liege.


Wenn diese Vorgehensweise richtig ist, dann könnte ich im Prinzip dasselbe auch mit den Audiodateien durchziehen. Im Forum habe ich leider nicht annähernd einen Hinweis darauf gefunden, wie ich aus dem Script "Neue Fotos" die Video- und Audiodateien ausklammern könnte.

Freundliche Grüße, Bommel

Nachtrag:

So, habe eben dein Script angepasst und getestet. Auf den ersten Blick funktioniert es ordentlich:

//################################# Start Custom Picture ###################################################
$file_ext = "jpg";//   < < <   write your file extension here  e.g.  "jpg" or "mp3"< < <
$num_new_images = "4";  //< < < how many images to be displayed < < <
$custom_sort = "i.image_date";  //< < < how order? e.g. " i.image_rating, i.image_hits, i.image_votes, i.image_downloads,,i.image_date"< < <

$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND ((image_media_file LIKE '%.jpg') OR (image_media_file LIKE '%.jpeg') OR (image_media_file LIKE '%.gif'))
        ORDER BY $custom_sort DESC
        LIMIT $num_new_images";
$result = $site_db->query($sql);
$num_rows3 = $site_db->get_numrows($result);

if (!$num_rows3)  {
  $new_images3 = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $new_images3 .= $lang['no_new_images'];
  $new_images3 .= "</td></tr></table>";
}
else  {
  $new_images3 = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  $count = 0;
  $bgcounter = 0;
  while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $new_images3 .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $new_images3 .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($image_row);
    $new_images3 .= $site_template->parse_template("thumbnail_bit");
    $new_images3 .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $new_images3 .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($num_new_images - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $new_images3 .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $new_images3 .= "</tr>\n";
    }
  }
  $new_images3 .= "</table>\n";
} // end else

$site_template->register_vars("custom_picture", $new_images3);
unset($new_images3);
//################################# End Custom Picture ###################################################


In der home.html habe ich anstelle von {new_images} dann {custom_picture} eingefügt. Jetzt werden mir nur noch die definierten Bilder angezeigt. Was sagst du als Profi dazu? Irgendwelche Fehler?

Freundliche Grüße, Bommel
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Rembrandt on January 23, 2010, 10:10:11 PM
so geht es auch nur etwas umständlich.   :mrgreen:

wenn du in der index.php in der original sql abfrage in der where zeile das hinten drann einfügst: AND image_media_file LIKE '%.jpg'
 hätte es auch gereicht.
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Bommel on January 23, 2010, 11:38:16 PM
Hallo Rembrandt,

ach menno... jetzt mach mir doch mit deiner plumpen Antwort nicht auch noch mein Erfolgserlebnis zunichte.  :D

Na gut, als Anfänger habe ich aber etwas dazu gelernt. Und nur das zählt für mich. Und natürlich auch mein Dank an dich und dieses Forum. Auf gehts... zum nächsten Punkt auf meiner Todo-Liste. Und das abgeänderte Script kann ich ja noch allemal für die Audiodateien verwenden. ;)

Freundliche Grüße, Bommel

Nachtrag:

Ähmm... ja, mir fällt gerade ein - ich habe ja den MOD "Private Images" (http://www.4homepages.de/forum/index.php?topic=26594.msg144378#msg144378) drinne:

//-----------------------------------------------------
//--- Show New Images ---------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "has_rss"   => true,
  "rss_title" => "RSS Feed: ".format_text($config['site_name'], 2)." (".str_replace(':', '', $lang['new_images']).")",
  "rss_url"   => $script_url."/rss.php?action=images"
));

$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
  $imgtable_width .= "%";
}

$additional_sql = "";
if (!empty($additional_image_fields)) {
  foreach ($additional_image_fields as $key => $val) {
    $additional_sql .= ", i.".$key;
  }
}

//#################################### Mod Privat Images ###################################################################
$num_new_images = $config['image_cells'];
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, i.image_auth_viewimage".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1  AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND i.image_id NOT IN (".get_auth_image_sql("image_auth_viewimage", "NOTIN").")
        ORDER BY i.image_date DESC
        LIMIT $num_new_images";
//#################################### Mod Privat Images ###################################################################

$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);

if (!$num_rows)  {
  $new_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $new_images .= $lang['no_new_images'];
  $new_images .= "</td></tr></table>";
}
else  {
  $new_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  $count = 0;
  $bgcounter = 0;
  while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $new_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $new_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($image_row);
    $new_images .= $site_template->parse_template("thumbnail_bit");
    $new_images .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $new_images .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $new_images .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $new_images .= "</tr>\n";
    }
  }
  $new_images .= "</table>\n";
} // end else

$site_template->register_vars("new_images", $new_images);
unset($new_images);


Muss da noch etwas beachtet werden oder kann ich das bedenkenlos hinten anfügen?

Freundliche Grüße, Bommel

Nachtrag:

Also ich glaube, dass ich eher bedenkenlos bin  :mrgreen:. Habe jetzt die Änderungen einfach gemacht und es scheint auf den ersten Blick zu funktionieren. Schaun mer ma, wann ich dann so 8O dreinschaue.

Gute Nacht allerseits  :wink:
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: GaYan on January 24, 2010, 02:44:09 AM
hey .. thanks for the great mod :) many many  thanks :...

but i have 1 more doubt... do u think this is elegant ?? because just think  if we add a new cat to our gallery.. we need edit the index.php again and again to show the laetst media from assigned cat  at home page ...

cant we set something from the admin panel. i think its possible..it will be a asy task for a programmer like you sir;;  :wink:
im just helping you.. dont misunderstand me .. this is just a suggestion for the great mod  :wink:

Thanks Alot Sir !

Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Bommel on January 24, 2010, 06:41:31 AM
Hello GaYan

... if we add a new cat to our gallery.. we need edit the index.php again and again to show the laetst media from assigned cat  at home page ...

cant we set something from the admin panel...

Maybe I missunderstand this, because my English is not so good. But why should be worked on every time index.php when a new category is added? The files from the new category are indicated with me. The already existing files, as well as the afterwards added files.

Yours sincerely, Bommel
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Rembrandt on January 24, 2010, 06:44:29 AM
@Gayan, i hope you mean that.

step 1.) and 2.) and the attachment from here.
http://www.4homepages.de/forum/index.php?topic=25131.msg137643#msg137643

3.) search in this code:

WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.$file_ext'

replace:

WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND i.cat_id IN (".$config['cat_rand_pic'].") AND image_media_file LIKE '%.$file_ext'


mfg Andi
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: GaYan on January 24, 2010, 08:52:19 AM
@ bommel ///

just think a incident like this.. you are displaying the latest images from cat 2 and 6 seperately in homepage by using this Rembrandt's Great mod ...

then.. just think  situation where we add a new cat to our gallery (cat ID 7) and we also need to display the latest images got from car ID 7 in the home page.. to do that.. we must edit the index.php again/./.

hope you got it ... :D :D my eng suckz as well :D :D bro :D :D

sir Rembrandt .. thanks for helping me out... :) thanks in advance man ..

Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Bommel on January 25, 2010, 10:32:30 AM
Hallo allerseits,

...Weiterhin besteht bei mir das Problem, dass Firefox die Videos nicht mit dem Windows-Media-Player abspielt. Wenn ich mich recht erinnere, dann liegt das wohl an diesem ActiveX von Microsoft. Kannst du mir einen Player empfehlen, der in allen gängigen Browsern funktioniert und auch die gängigsten Standard-Formate abspielen kann!...

Dieses Problem ist jetzt auch gelöst. Schuld an diesem Fehler war ein Add-On für FireFox namens "Move Media Player". Nachdem deaktivieren dieses Add-Ons funktioniert jetzt auch im FireFox das abspielen von Videos.  :D

Freundliche Grüße, Bommel

Hello Gayan,

now where I know that there one more MOD joins in I also understand the problem. Thanks for the explanation. :)

Yours sincerely, Bommel
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: GaYan on February 21, 2010, 05:08:19 AM
       
Code: [Select]
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.$file_ext' AND image_media_file LIKE '%.wmv'oder so
 
Code: [Select]
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_media_file LIKE '%.avi' AND image_media_file LIKE '%.wmv' AND image_media_file LIKE '%.flv'

 :( gives errors -

Code: [Select]
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/g2gayan/public_html/users/G2DesignLabz/G2script/includes/db_mysql.php on line 116
and sir thier is 1 more issue .. just hink that we set images2 for the latest videos from the gallery !
and to get the latest mp3 files from the gallery i again need to edit the index.php and use images3 or a customized var..

can we make a good solution for this ?  :( thanks alot :)
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Rembrandt on February 21, 2010, 06:55:26 AM
...
 gives errors -
that is correct: http://www.4homepages.de/forum/index.php?topic=25487.msg144846#msg144846
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: surferboy on March 03, 2010, 11:15:13 PM
Hi Andi,

Thanks for the great mod. I have installed it and have read through all the posts to add some of the other recommendations, like featuring other video formats, ... even if they won't play in some browsers. I will definitely push our members to use .flv.

Two questions:

1. In your mod, you recommend adding {custom_images} to the home.html table which I did but I wanted it to look neat and clean like the 'New Images' table. Attached is the pic of our page. I added a $lang setting in main.php for custom_images but it doesn't show. For the longest time, I couldn't understand why the new lang setting did not appear until I realized that the rows in the {custom_images} are taller than the {new_images} and for that reason, they are overlapping the bar above, hiding the lang setting.  Is there a code to adjust in the index.php for the {custom_images} or in the home.html code? Here is the code that I used in the home.html to construct the table.

<table width="828" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="4">
                          <tr>
                            <td class="head1" valign="top">{lang_new_images}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                    <tr>
                      <td class="head1">{new_images}</td>
                    </tr>
                  <b>
                <br />
                </td>
               <table width="828" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="4">
                          <tr>
                            <td class="head1" valign="top">{lang_custom_images}</td>
                          </tr>
                        </table>
                      </td>
                    </tr><br />
                    <tr>
                      <td class="head1">{custom_images}</td>
                    </tr>
                  <b>
                <br />
                </td>

2. In this thread, some of the users ask how to remove the video files from being featured in the New Images table. I tried to follow along but I just did not get it. Is is as simple as adding the code
Quote
AND ((image_media_file LIKE '%.flv') OR (image_media_file LIKE '%.wmv') OR (image_media_file LIKE '%.avi') OR (image_media_file LIKE '%.mov') OR (image_media_file LIKE '%.mpg'))

to the Show New Images section, and just specifying the media files that I want to see in the New Images section?
[EDIT] did that and specified .jpg, .gif, and .png   Success! Hopefully I am not shooting myself in the foot by omitting other file formats ...



Thanks,

Brian
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Rembrandt on March 04, 2010, 07:17:38 AM
Hi!

first the html part:
Code: [Select]
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="4">
                          <tr>
                            <td class="head1" valign="top">{lang_new_images}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                    <tr>
                      <td class="head1">{new_images}</td>
                    </tr>
                  </table>
                  <br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="4">
                          <tr>
                            <td class="head1" valign="top">{lang_custom_images}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                    <tr>
                      <td class="head1">{custom_images}</td>
                    </tr>
                  </table>
                  <br>

to your second question, this is the code for the custom slq:

WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND ((image_media_file LIKE '%.flv') OR (image_media_file LIKE '%.wmv') OR (image_media_file LIKE '%.avi') OR (image_media_file LIKE '%.mov') OR (image_media_file LIKE '%.mpg'))


and this is the part for the original slq query (new_images):

WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND NOT((image_media_file LIKE '%.flv') OR (image_media_file LIKE '%.wmv') OR (image_media_file LIKE '%.avi') OR (image_media_file LIKE '%.mov') OR (image_media_file LIKE '%.mpg'))


mfg Andi
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: surferboy on March 04, 2010, 10:50:07 AM
Hi Andi,

Thanks so much for providing the corrected template code.  I pasted everything just as you indicated but no luck on making the title appear in the bar. It still is half-covered.  I did a test where I changed the {lang_custom_images] to {lang_new_images} and sure enough, the title appeared, as 'New Images'

That makes me think the $lang code is not right but it is there in main.php, bright as day.  Then I wondered if somehow the code in the index.php file was creating the problem.  All I could find was a mention of {lang_new_images} with the RSS code in the original sequence.

I have no idea what is blocking this lang code from appearing!

Any ideas?

Thanks,

Brian
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Rembrandt on March 04, 2010, 11:54:23 AM
ahh.. ok
in lang/yourlang/main.php:

$lang['custom_images'] = "yourtext";


search in index.php:

$site_template->register_vars("custom_images", $new_images2);

and replace:

$site_template->register_vars(array(
"lang_custom_images" => $lang['custom_images'],
  "custom_images" => $new_images2
));


in the html file you can now write
Code: [Select]
{lang_custom_images}
mfg Andi
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: surferboy on March 04, 2010, 07:38:55 PM
Hi Andi,

Yes, that did the trick.  You didn't mention the file to replace the
$site_template->register_vars("custom_images", $new_images2);

but I understood what you meant - index.php

It looks so great. I love polish!

Thanks,

Brian
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: Rembrandt on March 04, 2010, 10:14:06 PM
...
but I understood what you meant - index.php....
yes, i am forgot to write

mfg Andi
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: surferboy on March 23, 2010, 08:18:02 PM
Hi -

Got another question about this MOD - latest 5 videos.

Just posted this reply on here:
http://www.4homepages.de/forum/index.php?topic=24054.msg146558#msg146558

I have installed the Media sites v1.9 MOD and got it working.

Is there a way to have these uploaded remote URL vids appear in this MOD, showing the latest 5 videos? That would be the ultimate perfect solution.  I know that the code in the index.php is very specific: it has to specify a file name for the vid to appear, and these remote uploaded URL's are not specific file names.

What do you think?

Thanks in advance for looking at this.

Cheers,

Brian
Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: V@no on March 24, 2010, 02:56:18 AM
Now that I know what mod you were referring to, I can suggest go different way, by using additional field where it would store file extension.
assuming you've added new database field into 4images_images table, named image_ext (there is a tutorial about additional fields, sorry, don't have time find that topic for you).

then in member.php find:
    if (!$uploaderror) {

insert below:
      $HTTP_POST_VARS['image_ext'] = get_file_extension($new_name);


this will store file extension (including virtual extensions from media sites mod) at image upload from members upload form.

after this you can modify mysql query for this mod to something like this:

$file_ext_list = $file_ext;
foreach($media_sites as $key => $val)
{
  $file_ext_list .= ",'" . $key . "'";
}

$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND (image_media_file LIKE '%.$file_ext' OR image_ext IN ($file_ext_list))
        ORDER BY $custom_sort DESC
        LIMIT $num_new_images";

Title: Re: [MOD] Latest 5 videos on Home-Site
Post by: surferboy on March 24, 2010, 07:31:52 AM
Hi -

Thanks for the help!

I made the changes to the member.php file and then pasted the query string you provided into the index.php file.  There was one glitch that was a major error but I fixed that - I added i.image_ext in the list of the query and that let me login but ...

then this error appears at the top of the home page:

An unexpected error occured. Please try again later.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home1/glrfinfo/public_html/gotchagallery/includes/db_mysql.php on line 116

and none of the previous files show up or any new uploaded files (I uploaded one .flv personal vid and one remote url youtube vid) 

I can understand why the older ones wouldn't show up - they don't have anything in the new image_ext field I added to the images table.  But then I had a look at the latest two entries in the table and nothing was entered in the image_ext field.

If we can just figure out why the uploads aren't adding any data into the new image_ext field, we might be good to go.

Thanks,

Brian