Author Topic: [Mod] Pinned Images  (Read 20833 times)

0 Members and 1 Guest are viewing this topic.

Offline nagmat

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • نغمات
[Mod] Pinned Images
« on: July 12, 2010, 04:09:37 AM »
I Want Mods or Plugins To Stick Images

For 4images 1.7.7
« Last Edit: July 15, 2010, 02:49:21 PM by V@no »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: I Want Mods or Plugins To Stick Images
« Reply #1 on: July 12, 2010, 04:36:53 AM »
This mod will show selected images first in the category no matter what sorting is selected, aka make images "pinned" or "sticky"
Demo: http://4images.vano.org/ajaxcomments/categories.php?cat_id=4 (option "Show "sticky" media first" option on the left)


1) add new field into 4images_images table (use phpmyadmin or similar)
Code: [Select]
ALTER TABLE 4images_images ADD image_sticky TINYINT( 1 ) UNSIGNED NOT NULL or download attached install_pin_images.php file, upload it to your 4images root directory and executed it. (thanks to Rembrandt for the installer)

2) add this line in includes/db_field_definitions.php (refer to this topic for more: [TUT] Zusätzliches Image Feld anlegen / Additional Image Field and how to make it multilanguage)
$additional_image_fields['image_sticky'] = array("Sticky""radio");


3) in categories.php find:
Code: [Select]
       ORDER BY ".$config['image_order']." ".$config['image_sort'].", i.image_id ".$config['image_sort']."Replace with:
Code: [Select]
       ORDER BY i.image_sticky DESC, ".$config['image_order']." ".$config['image_sort'].", i.image_id ".$config['image_sort']."

4) in details.php find three times:
Code: [Select]
         ORDER BY ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
Replace all of them with:
Code: [Select]
         ORDER BY image_sticky DESC, ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];

5) edit an image in ACP (Admin Control Panel) you should see a new radio button "Sticky"

6) if you would like display an icon for sticky images, edit thumbnail_bit.html template and add something similar to this:
Code: [Select]
{if image_sticky}
  <img src="{template_image_url}/pin.gif" style="float: right;" border="0">
{endif image_sticky}
(assuming you already have in templates/<your template>/images/ directory)
« Last Edit: July 15, 2010, 02:52:20 PM by V@no »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline nagmat

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • نغمات
Re: I Want Mods or Plugins To Stick Images
« Reply #2 on: July 12, 2010, 06:50:39 AM »
Streaming Experience

Offline nagmat

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • نغمات
Re: I Want Mods or Plugins To Stick Images
« Reply #3 on: July 13, 2010, 01:55:54 PM »
I done all but when stick file

dont sticky

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: I Want Mods or Plugins To Stick Images
« Reply #4 on: July 13, 2010, 02:11:31 PM »
Worked in my tests just fine.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline nagmat

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • نغمات
Re: I Want Mods or Plugins To Stick Images
« Reply #5 on: July 13, 2010, 02:44:52 PM »
Worked in my tests just fine.

seconed file are sticky from admincp

but is the seconed

http://nagmat.com/cat-%D9%86%D8%BA%D9%85%D8%A7%D8%AA-%D8%B9%D9%85%D8%B1%D9%88-%D8%AF%D9%8A%D8%A7%D8%A8-3.htm

And why
1) add new field into 4images_images table (use phpmyadmin or similar)

because I am add this but not Sure from this

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: I Want Mods or Plugins To Stick Images
« Reply #6 on: July 13, 2010, 03:03:44 PM »
that is how it supposed to look like:


Also, when you edit your "sticky" image, does it automatically select "yes" sticky option?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline nagmat

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • نغمات
Re: I Want Mods or Plugins To Stick Images
« Reply #7 on: July 13, 2010, 03:44:13 PM »
that is how it supposed to look like:


Also, when you edit your "sticky" image, does it automatically select "yes" sticky option?

why does it automatically select "yes" sticky option?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: I Want Mods or Plugins To Stick Images
« Reply #8 on: July 13, 2010, 04:19:19 PM »
because you said you set to "yes"..
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline nagmat

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • نغمات
Re: I Want Mods or Plugins To Stick Images
« Reply #9 on: July 14, 2010, 01:58:12 AM »
because you said you set to "yes"..

No No Iam said to you Iam Edit File of Mp3 In 4images admincp to sticky

you get me wrong

Thank you For your helping

and i wait you ............

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: I Want Mods or Plugins To Stick Images
« Reply #10 on: July 14, 2010, 02:41:53 AM »
Sorry, I have no idea what you are talking about...

Login as administrator, go to a category, click on the last image on the page, on image details page click edit link under the image, then at the bottom of the opened page set option "Sticky" to "yes", hit save button, now go to that category again, that image should be first now.

Here is a demo:
http://4images.vano.org/ajaxcomments/categories.php?cat_id=4
(you can play with the settings on left)
« Last Edit: July 14, 2010, 03:26:14 AM by V@no »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Rembrandt

  • Guest
Re: I Want Mods or Plugins To Stick Images
« Reply #11 on: July 15, 2010, 08:32:21 AM »
This Modification work perfectly.
Installer Added (attachment).
Thread titel adapted...

@V@no, can you say how the gifs (Stickys) be made in the thumbnails?  :)

mfg Andi
« Last Edit: July 15, 2010, 08:43:27 AM by Rembrandt »

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: [Mod] Stick Images
« Reply #12 on: July 15, 2010, 09:44:27 AM »
Was genau macht dieser Mod?

Rembrandt

  • Guest
Re: [Mod] Stick Images
« Reply #13 on: July 15, 2010, 11:56:04 AM »
Was genau macht dieser Mod?

in der category.html, egal welche sortierung du hast, die bilder die gepinnt sind werden zuerst angezeigt.
das solltest du eigentlich schon aus dem code herraus sehn können :)
auf V@nos demo page siehst du es auch..

mfg Andi

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: [Mod] Stick Images
« Reply #14 on: July 15, 2010, 01:09:50 PM »
Achso, dass ist ja interessant! :D