4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: noyou on April 03, 2006, 09:10:56 AM

Title: how to embed a link to image page?
Post by: noyou 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?

Title: Re: how to embed a link to image page?
Post by: V@no 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.
Title: Re: how to embed a link to image page?
Post by: noyou 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
Title: Re: how to embed a link to image page?
Post by: noyou 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.
Title: Re: how to embed a link to image page?
Post by: V@no on April 05, 2006, 06:18:53 AM
you must failed in db_field_definitions.php
Title: Re: how to embed a link to image page?
Post by: noyou 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?
Title: Re: how to embed a link to image page?
Post by: V@no 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!
Title: Re: how to embed a link to image page?
Post by: Flo2005 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 :(
Title: Re: how to embed a link to image page?
Post by: V@no 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>