Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
[Script Modyfication] Image Add Form

 
Reply to topic    Forum Index » Suggestions View previous topic
View next topic
[Script Modyfication] Image Add Form
Author Message
crusi1986



Joined: 14 Sep 2008
Posts: 13

Post [Script Modyfication] Image Add Form Reply with quote
Hi. Sorry for my english but it's very weak Sad

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 Smile

_________________
What don't kill us will make us stronger...
Sun Sep 14, 2008 9:31 pm View user's profile Send private message
Guest








Please login to hide the ads.

Torstein



Joined: 03 Aug 2006
Posts: 106

Post Reply with quote
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 View user's profile Send private message
crusi1986



Joined: 14 Sep 2008
Posts: 13

Post Reply with quote
Thanks for reply. Tell me please how can i make it with xfields because i have no idea Smile

_________________
What don't kill us will make us stronger...
Mon Sep 15, 2008 7:48 am View user's profile Send private message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2801
Location: Germany

Post Reply with quote
I think there's no need to do it with XFields. Simply add the code to inc/mod/images.mdu.

1. Find this:
Code:
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:
Code:
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:
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>' : '&nbsp;');
      }


and change it to 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>' : '&nbsp;');

         $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>' : '&nbsp;');

         $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>' : '&nbsp;');
      }


And change this:
Code:
  <?=($area ? '<td>'.$insert : ''); ?>


to this:
Code:
  <?=($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 View user's profile Send private message
crusi1986



Joined: 14 Sep 2008
Posts: 13

Post Reply with quote
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:

Code:

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 View user's profile Send private message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2801
Location: Germany

Post Reply with quote
I changed the code above. Please try again.
Thu Sep 25, 2008 5:09 pm View user's profile Send private message
crusi1986



Joined: 14 Sep 2008
Posts: 13

Post Reply with quote
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:

Code:

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:

Code:

http://localhost/ftp/tkkf_v12b/engine/%7Bimagepath%7D/subfolders/gal_starowkadelta070908/dsc02506.jpg


I think there is need to edit something in this code:
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>' : '&nbsp;');
      }


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 View user's profile Send private message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2801
Location: Germany

Post Reply with quote
You are right - wrong code. I changed it again. Please try again.
Fri Oct 03, 2008 9:10 am View user's profile Send private message
crusi1986



Joined: 14 Sep 2008
Posts: 13

Post Reply with quote
There is still something wrong Sad

Now insert code is:
Code:
javascript:insertimage('<a%20title="Wstaw%20miniaturk%C4%99%20w%20full%20newsie"href="javascript:insertimage('&lt;a%20target=&quot;_blank&quot;%20href=&quot;{imagepath}/subfolders/gal_starowkadelta070908/dsc02506.jpg&quot;&gt;&lt;img%20%20src=&quot;{imagepath}/subfolders/gal_starowkadelta070908/thumbs/dsc02506.jpg&quot;%20alt=&quot;dsc02506.jpg&quot;%20border=&quot;0&quot;%20width=&quot;120&quot;%20height=&quot;90&quot;%20/&gt;&lt;/a&gt;')">[Wstaw]</a>')

Should be:
Code:
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 View user's profile Send private message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2801
Location: Germany

Post Reply with quote
Ok, now I got it. Try again. Smile
Fri Oct 03, 2008 10:36 am View user's profile Send private message
crusi1986



Joined: 14 Sep 2008
Posts: 13

Post Reply with quote
Finally it's working! Thanks FI-DD you're the best Very Happy

BTW i've found bug in images add form. When you go to the next page in image add form insert image link dissapear Smile

_________________
What don't kill us will make us stronger...
Fri Oct 03, 2008 11:41 am View user's profile Send private message
Display posts from previous:    
Reply to topic    Forum Index » Suggestions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.