Author Topic: [MOD] Show best images on extern page  (Read 58272 times)

0 Members and 1 Guest are viewing this topic.

Offline sami1255

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: [MOD] Show best images on extern page
« Reply #15 on: October 16, 2007, 11:51:49 PM »
What if i want 10 most viewed pictures instead of one.. hope there will be only slight modification..  :roll:

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Show best images on extern page
« Reply #16 on: October 17, 2007, 12:54:49 AM »
Good god - lot of SQL query there ...  8O

@sami1255:

if change all this in code:

Quote
LIMIT 1";

Change 1 for your value. .;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline sami1255

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: [MOD] Show best images on extern page
« Reply #17 on: October 17, 2007, 07:27:49 AM »
i tried that.. didnt work for me..  :cry: the mod still shows the same 5 images..

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Show best images on extern page
« Reply #18 on: October 17, 2007, 01:02:37 PM »
If you clear cookies, temp files, close browser, re-open browser to gallery - is same result ?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline sami1255

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: [MOD] Show best images on extern page
« Reply #19 on: October 17, 2007, 03:44:09 PM »
yeah.. its the same..! :roll:

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Show best images on extern page
« Reply #20 on: October 17, 2007, 08:13:50 PM »
Ask author of MOD. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline darvid

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • KNOWTEBOOK.COM - Community for webdeveloper
Re: [MOD] Show best images on extern page
« Reply #21 on: October 17, 2007, 09:06:54 PM »
sami, u cant show more than one BEST image. the mod is not like top.php and shows the ranking of the 20 best pics. the mod shows you THE BEST image either by download, by comments, by hits and so on. u ve got to decide, what u want. this might not be the right mod for u.
/* KNOWTEBOOK - BoostYourself community for webdeveloper
/* http://www.knowtebook.com

Integration von Wordpress Blog, PHPBB Forum und 4Images Bildergalerie:
http://www.sebastianscheuer.de/aktuell/integration-von-wordpress-blog-phpbb-forum-und-4images-bildergallerie/
DEMO: http://www.pilotenbilder.de/

Offline sami1255

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: [MOD] Show best images on extern page
« Reply #22 on: October 17, 2007, 09:24:01 PM »
thanks c-bass for your quick reply..  :)

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Show best images on extern page
« Reply #23 on: October 17, 2007, 09:43:26 PM »
@c-bass:

One thing. After function is_remote block,

add this:

Code: [Select]
function safe_htmlspecialchars($chars) {
  // Translate all non-unicode entities
  $chars = preg_replace(
    '/&(?!(#[0-9]+|[a-z]+);)/si',
    '&',
    $chars
  );

  $chars = str_replace(">", ">",   $chars);
  $chars = str_replace("<", "&lt;",   $chars);
  $chars = str_replace('"', "&quot;", $chars);
  return $chars;
}

function replace_url($text) {
  $text = " ".$text." ";
  $url_search_array = array(
    "#([^]_a-z0-9-=\"'\/])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^, \(\)<>\n\r]*)?)#si",
    "#([^]_a-z0-9-=\"'\/])([a-z]+?)://([^, \(\)<>\n\r]+)#si"
  );

  $url_replace_array = array(
    "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\" rel=\"nofollow\">www.\\2.\\3\\4</a>",
    "\\1<a href=\"\\2://\\3\" target=\"_blank\" rel=\"nofollow\">\\2://\\3</a>",
  );
  $text = preg_replace($url_search_array, $url_replace_array, $text);

  if (strpos($text, "@")) {
    $text = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $text);
  }
  return substr($text, 1, -1);
}

function replace_badwords($text) {
  global $config, $split_badwords;
  if ($config['badword_list'] != "") {
    if (!isset($split_badwords)) {
      $badwords = trim($config['badword_list']);
      $badwords = preg_replace("/[\n\r]/is", " ", $badwords);
      $badwords = str_replace(","," ",$badwords);
      $badwords = preg_quote($badwords);
      $badwords = str_replace('/', '\\/', $badwords);
      $split_badwords = preg_split("/\s+/", $badwords);
    }

    foreach ($split_badwords as $key => $val) {
      if ($val != "") {
        if (substr($val, 0, 2) == "\\{") {
          $val = substr($val, 2, -2);
          $text = trim(preg_replace("/([^A-Za-z])".$val."(?=[^A-Za-z])/si", "\\1".str_repeat($config['badword_replace_char'], strlen($val)), " $text "));
        }
        else {
          $text = trim(preg_replace("/$val/si", str_repeat($config['badword_replace_char'], strlen($val)), " $text "));
        }
      }
    }
  }
  return $text;
}

function format_text($text, $html = 0, $word_wrap = 0, $bbcode = 0, $bbcode_img = 0) {
  if ($word_wrap && $text != "") {
    $text = preg_replace("/([^\n\r ?&\.\/<>\"\\-]{".$word_wrap."})/i", " \\1\n", $text);
  }

  if ($html == 0 || $html == 2) {
    $text = safe_htmlspecialchars($text);
  }

  if ($html !== 2) {
    $text = nl2br(trim($text));
    $text = replace_url($text);
  }

  if ($bbcode == 1) {
    $search_array = array(
      "/(\[)(list)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/list)(((=)(\\4)([^\"']*)(\\4]))|(\]))/siU",
      "/(\[)(list)(])(.*)(\[\/list\])/siU",
      "/(\[\*\])/siU",
      "/(\[\/\*\])/siU",
      "/(\[)(url)(=)(['\"]?)(www\.)([^\"']*)(\\4])(.*)(\[\/url\])/siU",
      "/(\[)(url)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/url\])/siU",
      "/(\[)(url)(])(www\.)([^\"]*)(\[\/url\])/siU",
      "/(\[)(url)(])([^\"]*)(\[\/url\])/siU",
      "/(\[)(code)(])(\r\n)*(.*)(\[\/code\])/siU",
      "/javascript:/si",
      "/about:/si"
    );
    $replace_array = array(
      "<ol type=\"\\5\">\\7</ol>",
      "<ul>\\4</ul>",
      "<li>",
      "</li>",
      "<a href=\"http://www.\\6\" target=\"_blank\" rel=\"nofollow\">\\8</a>",
      "<a href=\"\\5\" target=\"_blank\" rel=\"nofollow\">\\7</a>",
      "<a href=\"http://www.\\5\" target=\"_blank\" rel=\"nofollow\">www.\\5</a>",
      "<a href=\"\\4\" target=\"_blank\" rel=\"nofollow\">\\4</a>",
      "<pre>Code:<hr size=1>\\5<hr size=1></pre>",
      "java script:",
      "about :"
    );
    $text = preg_replace($search_array, $replace_array, $text);
    if (!$bbcode_img)  {
      $text = preg_replace("/(\[)(img)(])(\r\n)*([^\"]*)(\[\/img\])/siU", "<a href=\"\\5\" target=\"_blank\">\\5</a>", $text);
    }
    else  {
      $text = preg_replace("/(\[)(img)(])(\r\n)*([^\"]*)(\[\/img\])/siU", "<img src=\"\\5\">", $text);
    }
    $text = preg_replace("/(\[)(b)(])(\r\n)*([^\"]*)(\[\/b\])/siU", "<b>\\5</b>", $text);
    $text = preg_replace("/(\[)(i)(])(\r\n)*([^\"]*)(\[\/i\])/siU", "<i>\\5</i>", $text);
    $text = preg_replace("/(\[)(u)(])(\r\n)*([^\"]*)(\[\/u\])/siU", "<u>\\5</u>", $text);

    $text = replace_badwords($text);
  }

  $text = str_replace("\\'", "'", $text);

  return $text;
}

Replace all:

Quote
$image_name = $row['image_name'];

for:

Code: [Select]
$image_name = format_text(trim($row['image_name']), 2);
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline mathuatden

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: [MOD] Show best images on extern page
« Reply #24 on: October 24, 2007, 12:22:53 PM »
I have an error with this mod
My error is when member post a comment is in my gallery have 2 same comments

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Show best images on extern page
« Reply #25 on: October 24, 2007, 01:07:23 PM »
Quote
My error is when member post a comment is in my gallery have 2 same comments

This is right. I no think 4images use compare for match comments in details.php file.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline darvid

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • KNOWTEBOOK.COM - Community for webdeveloper
Re: [MOD] Show best images on extern page
« Reply #26 on: October 24, 2007, 05:05:25 PM »
this should have nothing to do with this mod.
/* KNOWTEBOOK - BoostYourself community for webdeveloper
/* http://www.knowtebook.com

Integration von Wordpress Blog, PHPBB Forum und 4Images Bildergalerie:
http://www.sebastianscheuer.de/aktuell/integration-von-wordpress-blog-phpbb-forum-und-4images-bildergallerie/
DEMO: http://www.pilotenbilder.de/

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [MOD] Show best images on extern page
« Reply #27 on: October 24, 2007, 08:32:17 PM »
No, is nothing to do. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline naist

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [MOD] Show best images on extern page
« Reply #28 on: December 16, 2007, 07:35:31 PM »
I've installed the mod, but the images are not shown on extern pages but only image names and the links for this images. Look at the screenshot. I've used the Include code on the external page, but something must be wrong. Any idea?

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: [MOD] Show best images on extern page
« Reply #29 on: December 16, 2007, 08:05:44 PM »
Hi naist,

i thing, you lost a part of this modcode (img src):
Code: [Select]
echo "<td><a href=\"".SITE_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"></a><br>\n";


Kurt