Author Topic: how to embed a link to image page?  (Read 14100 times)

0 Members and 1 Guest are viewing this topic.

Offline noyou

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • http://www.nowife.com/photo/index.php
how to embed a link to image page?
« on: April 03, 2006, 09:10:56 AM »
I am using 4image1.72, how to embed a link to image page?

I want people click the thumb, they will see the image, if they continue to click on the image, the embeded image with links will send them to other website.

If it's possible, then is it possible to embed different website links with different images/ different categories?


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: how to embed a link to image page?
« Reply #1 on: April 04, 2006, 01:54:50 AM »
the basics:
1) add a new field into 4images_images table, lets for example call it image_url make it VARCHAR(255)
2) update includes/db_field_definitions.php (read comments inside that file) (make it text type)
3) in media templates (jpeg.html, gif.html, etc) use the following:[qcode]{if image_url}<a href="{image_url}" target="_blank">{endif image_url}<img src="{media_src}" border="1" alt="{image_name}"{width_height} />{if image_url}</a>{endif image_url}[/qcode]

now, when you edit an image in ACP, you should see a new field where you can enter a URL to the site you want this image to have link to.
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 noyou

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • http://www.nowife.com/photo/index.php
Re: how to embed a link to image page?
« Reply #2 on: April 04, 2006, 03:09:10 AM »
the basics:
1) add a new field into 4images_images table, lets for example call it image_url make it VARCHAR(255)
2) update includes/db_field_definitions.php (read comments inside that file) (make it text type)
3) in media templates (jpeg.html, gif.html, etc) use the following:[qcode]{if image_url}<a href="{image_url}" target="_blank">{endif image_url}<img src="{media_src}" border="1" alt="{image_name}"{width_height} />{if image_url}</a>{endif image_url}[/qcode]

now, when you edit an image in ACP, you should see a new field where you can enter a URL to the site you want this image to have link to.

Thank you V@no,

But how should I "add a new field into 4images_images table" I am not familiar with mySQL language

Offline noyou

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • http://www.nowife.com/photo/index.php
Re: how to embed a link to image page?
« Reply #3 on: April 05, 2006, 05:57:28 AM »
V@no, I have tried, fields created successful, initiated successful, but last step, click on it, it came out blank,

Seems that the {image_url} didn't deliver the value stored in the image table. any ideas?

http://www.tgp888.com/models-pornstars-free-nude-photos/categories.php?cat_id=33

all images under this cat connect to http://www.femjoy.com, I have check the database, the link all there, I just use your code for jpg.html, it just didn't work.

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: how to embed a link to image page?
« Reply #4 on: April 05, 2006, 06:18:53 AM »
you must failed in db_field_definitions.php
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 noyou

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • http://www.nowife.com/photo/index.php
Re: how to embed a link to image page?
« Reply #5 on: April 05, 2006, 08:08:50 AM »
you must failed in db_field_definitions.php
"
if (!defined('ROOT_PATH')) {
  die("Security violation");
}
$additional_image_fields['image_url'] = array($lang['image_url'], "text", 0);
"

are my codes, do you think there is something wrong?

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: how to embed a link to image page?
« Reply #6 on: April 05, 2006, 08:58:06 AM »
for what I see right now, you did not add {if ..} {endif ..} tags. they are commented out!
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 Flo2005

  • Full Member
  • ***
  • Posts: 237
  • Copy & Paste Profi :)
    • View Profile
    • snuup.de! - Bilder - Sounds - Videos - fun4FREE!
Re: how to embed a link to image page?
« Reply #7 on: April 07, 2006, 01:03:40 PM »
This code doesn´t generate the URL automatically for the file! I´m right?

It will take much of time to edit every file to give him his own URL :(

Project offline

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: how to embed a link to image page?
« Reply #8 on: April 07, 2006, 02:35:47 PM »
that is correct.
you can do:
1) run a mysql query and add "default" url to each image
Code: [Select]
UPDATE 4images_images SET image_url = "http://somesite.com/" WHERE image_url = ""
2) you can add another set of {ifnot ..} {endifnot ..} (asuming your are using v1.7.2 or {ifno ..}{endifno ..} for previous version, but it required additional code changes for these)
Code: [Select]
{if image_url}<a href="{image_url}" target="_blank">{endif image_url}{ifnot image_url}<a href="http://somesite.com/" target="_blank">{endifnot image_url}<img src="{media_src}" border="1" alt="{image_name}"{width_height} /></a>
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)