Author Topic: Colored Image Name  (Read 5542 times)

0 Members and 1 Guest are viewing this topic.

Offline blue4603

  • Pre-Newbie
  • Posts: 7
    • View Profile
Colored Image Name
« on: December 01, 2008, 07:00:39 PM »
Hi

I tried 4images 1.7.6 today on my test machine and it is really amazing.
 
I noticed that the image names colors are taken from the css style.

How about a mod that makes the image names colored using standard HTML codes?

Could you help me plz?

Thank you

Regards

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: Colored Image Name
« Reply #1 on: December 02, 2008, 12:35:56 AM »
Hello and welcome to 4images forum.

What is the purpose for this?
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 blue4603

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: Colored Image Name
« Reply #2 on: December 02, 2008, 08:17:25 PM »
Hi

I will give you an example

let say we have an image of a green tree it would be nice that the name of this image is also green.

or if we have a pink flower or a blue ocean.

I hope you got the idea.

Regards

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: Colored Image Name
« Reply #3 on: December 03, 2008, 02:16:24 AM »
1) add a new field into 4images_images table, lets call it "image_color". You can execute in your mysql manager (phpmyadmin):
Code: [Select]
ALTER TABLE `4images_images` ADD `image_color` VARCHAR( 20 ) NOT NULL2) in includes/db_fields_definitions.php add:
Code: [Select]
$additional_image_fields['image_color'] = array("Image Color", "text", 0);
3) edit your images and you should see new field "Image Color". You can either use CSS class name or HEX color code or color name, whatever.
4) in details.html template use something like this (as an example Image Color contains CSS class name):

Code: [Select]
{if image_color}<span class="{image_color}">{endif image_color}{image_name}{if image_color}</span>{endif image_color}
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 blue4603

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: Colored Image Name
« Reply #4 on: December 03, 2008, 06:11:04 PM »
Hi

Thanks for the response.

It is a nice idea. However, it is not what I had in my mind.

If we use your idea then the image name will have on color but how about if I we need to be multicolored?

I will explain with an example:

Let say that the image name is Red Sea < I want the word Red colored with red and Sea colored with blue.

I hope you got what I mean.

I tried to stop the script from escaping special characters but there were many problems.

I hope you help me.

and thanks for your help

Regards

Offline V@nо

  • Addicted member
  • ******
  • Posts: 1.223
    • View Profile
Re: Colored Image Name
« Reply #5 on: December 03, 2008, 09:41:06 PM »
oh, I see. In that case the simpliest way whould be use html in the names
that method would require searching in .php files for image_name and if it's in format_text (i.e. format_text($image_name, 2);
replase "2" with "1"

if that worked and on your site members/guests can upload images, then there something else has to be done to prevent them using html for security reasons
Your first three "must do" before you ask a question:
If I asked you to PM me, I meant PM to my primary account, this account doesn't accept PMs.

Offline blue4603

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: Colored Image Name
« Reply #6 on: December 05, 2008, 04:02:02 PM »
Hi

Thanks a lot that worked like a charm.

I think if we just change the format_text($image_name, 2) that is found in the functions.php file that would be enough.

Thank you again

Regards