| Author |
Message |
crusi1986
Joined: 14 Sep 2008 Posts: 13
|
|
[Script Modyfication] Image Add Form |
|
Hi. Sorry for my english but it's very weak
I've got a small request. Could somebody add 2 additional options in images add form? I need something like 2 checkboxes: "Lightbox image" and "Lightbox gallery".
If you check "Lightbox image" and if image has thumbnail then added code will be: <a href="imagepath_here" rel="lightbox">thumbnail_here</a>.
When you check option "Lightbox gallery" and image has thumbnail then added code will be: <a href="imagepath_here" rel="lightbox[image_folder_name_here]">thumbnail_here</a>
I know that there is mygallery manager which use lightbox, but i don't like and don't need this plugin and i like to use lightbox in my site. Thanks for any help 
_________________ What don't kill us will make us stronger... |
|
| Sun Sep 14, 2008 9:31 pm |
|
 |
Guest
|
|
|
Please login to hide the ads.
|
|
|
|
 |
Torstein
Joined: 03 Aug 2006 Posts: 106
|
|
|
|
Check out X-fields or Cutefields (search it up on this forum).
Basically both makes you able to create custom fields, and use it in your template.
I hope this helps =)
|
|
| Sun Sep 14, 2008 10:27 pm |
|
 |
crusi1986
Joined: 14 Sep 2008 Posts: 13
|
|
|
|
Thanks for reply. Tell me please how can i make it with xfields because i have no idea 
_________________ What don't kill us will make us stronger... |
|
| Mon Sep 15, 2008 7:48 am |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
I think there's no need to do it with XFields. Simply add the code to inc/mod/images.mdu.
1. Find this:
 |  | else{
$insert = '<a target="_blank" href="{imagepath}/'.($user ? $user.'/' : '').($subfolder ? 'subfolders/'.$subfolder.'/' : '').$file.'"><img '.($_GET['align'] == 'left' ? 'align="left"' : ($_GET['align'] == 'right' ? 'align="right"' : ($_GET['align'] == 'none' ? '' : $default_align))).' src="{imagepath}/'.($user ? $user.'/' : '').($subfolder ? 'subfolders/'.$subfolder.'/' : '').'thumbs/'.$file.'" alt="'.$file.'" border="0" '.$info[3].' /></a>';
} |
and change it to this:
 |  | else{
$insert = '<a target="_blank" href="{imagepath}/'.($user ? $user.'/' : '').($subfolder ? 'subfolders/'.$subfolder.'/' : '').$file.'"><img '.($_GET['align'] == 'left' ? 'align="left"' : ($_GET['align'] == 'right' ? 'align="right"' : ($_GET['align'] == 'none' ? '' : $default_align))).' src="{imagepath}/'.($user ? $user.'/' : '').($subfolder ? 'subfolders/'.$subfolder.'/' : '').'thumbs/'.$file.'" alt="'.$file.'" border="0" '.$info[3].' /></a>';
$insert2 = '<a rel="lightbox" target="_blank" href="{imagepath}/'.($user ? $user.'/' : '').($subfolder ? 'subfolders/'.$subfolder.'/' : '').$file.'"><img '.($_GET['align'] == 'left' ? 'align="left"' : ($_GET['align'] == 'right' ? 'align="right"' : ($_GET['align'] == 'none' ? '' : $default_align))).' src="{imagepath}/'.($user ? $user.'/' : '').($subfolder ? 'subfolders/'.$subfolder.'/' : '').'thumbs/'.$file.'" alt="'.$file.'" border="0" '.$info[3].' /></a>';
$insert3 = '<a rel="lightbox['.$folder.']" target="_blank" href="{imagepath}/'.($user ? $user.'/' : '').($subfolder ? 'subfolders/'.$subfolder.'/' : '').$file.'"><img '.($_GET['align'] == 'left' ? 'align="left"' : ($_GET['align'] == 'right' ? 'align="right"' : ($_GET['align'] == 'none' ? '' : $default_align))).' src="{imagepath}/'.($user ? $user.'/' : '').($subfolder ? 'subfolders/'.$subfolder.'/' : '').'thumbs/'.$file.'" alt="'.$file.'" border="0" '.$info[3].' /></a>';
} |
2. Find this:
 |  | if(in_array(strtolower(end(explode('.', $file))), $allowed_extensions)){
$insert = ($area ? '<a '.(file_exists($folder.'/thumbs/'.$file) ? 'title="'.sprintf($echo['insertThumbTitle'], $area).'"' : 'title="'.sprintf($echo['insertImageTitle'], $area).'"').'href="javascript:insertimage(\''.htmlspecialchars($insert).'\')">'.$echo['insert'].'</a>' : ' ');
} |
and change it to this:
 |  | if(in_array(strtolower(end(explode('.', $file))), $allowed_extensions)){
$insert = ($area ? '<a '.(file_exists($folder.'/thumbs/'.$file) ? 'title="'.sprintf($echo['insertThumbTitle'], $area).'"' : 'title="'.sprintf($echo['insertImageTitle'], $area).'"').'href="javascript:insertimage(\''.htmlspecialchars($insert).'\')">'.$echo['insert'].'</a>' : ' ');
$insert2 = ($area ? '<a rel="lightbox" '.(file_exists($folder.'/thumbs/'.$file) ? 'title="'.sprintf($echo['insertThumbTitle'], $area).'"' : 'title="'.sprintf($echo['insertImageTitle'], $area).'"').'href="javascript:insertimage(\''.htmlspecialchars($insert2).'\')">lightbox</a>' : ' ');
$insert3 = ($area ? '<a rel="lightbox['.$folder.']" '.(file_exists($folder.'/thumbs/'.$file) ? 'title="'.sprintf($echo['insertThumbTitle'], $area).'"' : 'title="'.sprintf($echo['insertImageTitle'], $area).'"').'href="javascript:insertimage(\''.htmlspecialchars($insert3).'\')">lightbox_gallery</a>' : ' ');
} |
And change this:
 |  | <?=($area ? '<td>'.$insert : ''); ?> |
to this:
 |  | <?=($area ? '<td>'.$insert.' '.$insert2.' '.$insert3 : ''); ?> |
Last edited by FI-DD on Fri Oct 03, 2008 10:35 am; edited 4 times in total |
|
| Thu Sep 18, 2008 5:49 pm |
|
 |
crusi1986
Joined: 14 Sep 2008 Posts: 13
|
|
|
|
FI-DD thanks for your help, this is exactly what i want to do. Unfortunetly i think that i'm doing something wrong because when i check the image box or gallery box, the rel="lightbox" or rel="gallery[]" not adding into the code.
I'm not sure what i have to do with:
 |  |
Image: <input type="checkbox" name="lb_image" value="true" />
Gallery: <input type="checkbox" name="lb_gallery" value="true" />
|
In what form i have to add this code?
_________________ What don't kill us will make us stronger... |
|
| Fri Sep 19, 2008 11:12 am |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
I changed the code above. Please try again.
|
|
| Thu Sep 25, 2008 5:09 pm |
|
 |
crusi1986
Joined: 14 Sep 2008 Posts: 13
|
|
|
|
Unfortunately this isn't working. When i click on link i got error 404. I think You are editing wrong code or something, because normal image insert link is:
 |  |
javascript:insertimage('<a target="_blank" href="{imagepath}/subfolders/gal_starowkadelta070908/dsc02506.jpg"><img src="{imagepath}/subfolders/gal_starowkadelta070908/thumbs/dsc02506.jpg" alt="dsc02506.jpg" border="0" width="120" height="90" /></a>')
|
and the lb_image insert code, or lb_gallery insert code is:
 |  |
http://localhost/ftp/tkkf_v12b/engine/%7Bimagepath%7D/subfolders/gal_starowkadelta070908/dsc02506.jpg
|
I think there is need to edit something in this code:
 |  |
if(in_array(strtolower(end(explode('.', $file))), $allowed_extensions)){
$insert = ($area ? '<a '.(file_exists($folder.'/thumbs/'.$file) ? 'title="'.sprintf($echo['insertThumbTitle'], $area).'"' : 'title="'.sprintf($echo['insertImageTitle'], $area).'"').'href="javascript:insertimage(\''.htmlspecialchars($insert).'\')">'.$echo['insert'].'</a>' : ' ');
}
|
because when i change $insert in the above code into $insert2, then your insert2 code is working.
_________________ What don't kill us will make us stronger... |
|
| Fri Sep 26, 2008 9:23 am |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
You are right - wrong code. I changed it again. Please try again.
|
|
| Fri Oct 03, 2008 9:10 am |
|
 |
crusi1986
Joined: 14 Sep 2008 Posts: 13
|
|
|
|
There is still something wrong
Now insert code is:
 |  | javascript:insertimage('<a%20title="Wstaw%20miniaturk%C4%99%20w%20full%20newsie"href="javascript:insertimage('<a%20target="_blank"%20href="{imagepath}/subfolders/gal_starowkadelta070908/dsc02506.jpg"><img%20%20src="{imagepath}/subfolders/gal_starowkadelta070908/thumbs/dsc02506.jpg"%20alt="dsc02506.jpg"%20border="0"%20width="120"%20height="90"%20/></a>')">[Wstaw]</a>') |
Should be:
 |  | javascript:insertimage('<a%20rel="lightbox"%20href="{imagepath}/subfolders/gal_starowkadelta070908/dsc02506.jpg"><img%20%20src="{imagepath}/subfolders/gal_starowkadelta070908/thumbs/dsc02506.jpg"%20alt="dsc02506.jpg"%20border="0"%20width="120"%20height="90"%20/></a>') |
I have no idea whats wrong this time.
_________________ What don't kill us will make us stronger... |
|
| Fri Oct 03, 2008 10:12 am |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
Ok, now I got it. Try again. 
|
|
| Fri Oct 03, 2008 10:36 am |
|
 |
crusi1986
Joined: 14 Sep 2008 Posts: 13
|
|
|
|
Finally it's working! Thanks FI-DD you're the best
BTW i've found bug in images add form. When you go to the next page in image add form insert image link dissapear 
_________________ What don't kill us will make us stronger... |
|
| Fri Oct 03, 2008 11:41 am |
|
 |
|