XFileSharing Pro - Making export links show thumbs

Message
Author
Jesse202
Posts: 246
Joined: May 07, 2010 6:24 pm

Making export links show thumbs

#1 Postby Jesse202 » Aug 13, 2012 5:35 pm

I do not see why the html and bb code is not showing the thumb. I've played around with the code. Here's the default from the index.cgi. Any ideas?

Code: Select all


sub MyFilesExport
{
   my $filter;
   if($f->{file_id})
   {
      my $ids = join ',', grep{/^\d+$/}@{ARef($f->{file_id})};
      $filter="AND file_id IN ($ids)" if $ids;
   }
   else
   {
      $filter="AND file_fld_id='$f->{fld_id}'" if $f->{fld_id}=~/^\d+$/;
   }
   my $list = $db->SelectARef("SELECT * FROM Files f, Servers s
                               WHERE usr_id=? 
                               AND f.srv_id=s.srv_id
                               $filter 
                               ORDER BY file_name",$ses->getUserId);
   print $ses->{cgi_query}->header( -type    => 'text/html',
                                    -expires => '-1d',
                                    -charset => $c->{charset});
   my (@list,@list_bb,@list_html);
   for my $file (@$list)
   {
      $file->{download_link} = $ses->makeFileLink($file);
      if($c->{image_mod} && $file->{file_name}=~/\.(jpg|jpeg|gif|png|bmp)$/i)
      {
         $ses->getThumbLink($file);
      }
      else
      {
         $file->{fsize} = $ses->makeFileSize($file->{file_size});
      }
      push @list, $file->{download_link};
      push @list_bb, $file->{thumb_url} ? "[URL=$file->{download_link}][IMG]$file->{thumb_url}\[\/IMG]\[\/URL]" : "[URL=$file->{download_link}]$file->{file_name} - $file->{fsize}\[\/URL]";
      push @list_html, $file->{thumb_url} ? qq[<a href="$file->{download_link}" target=_blank><img src="$file->{thumb_url}" border=0><\/a>"] : qq[<a href="$file->{download_link}" target=_blank>$file->{file_name} - $file->{fsize}<\/a>];
   }
   print"<HTML><BODY style='font: 13px Arial;'>";
   print"<b>Download links</b><br><textarea cols=100 rows=10 wrap=off>".join("\n",@list)."<\/textarea><br><br>";
   print"<b>Forum code</b><br><textarea cols=100 rows=10 wrap=off>".join("\n",@list_bb)."<\/textarea><br><br>";
   print"<b>HTML code</b><br><textarea cols=100 rows=10 wrap=off>".join("\n",@list_html)."<\/textarea><br><br>";
   exit;
}

PowerChaos
Posts: 521
Joined: Dec 19, 2009 5:12 pm

#2 Postby PowerChaos » Aug 13, 2012 10:07 pm

why messinng around in index.php when you can use this code in download1.html ( /cgi-bin/templates/

Code: Select all

<div class="tabbertab">
<h2><TMPL_VAR lang_forum_link></h2>
<textarea id="ic1-<TMPL_VAR file_id>" style="width:98%;" cols=24 rows=3 onFocus="copy(this);">[URL=<TMPL_VAR download_link>]<TMPL_VAR file_name> - <TMPL_VAR fsize>[/URL]</textarea>
<div id="c1-<TMPL_VAR file_id>" class="btndiv"><TMPL_VAR lang_copy_clipboard></div>
</div>
and to show the image

Code: Select all

<p><img src="<TMPL_VAR image_url>" class="pic" alt="<TMPL_VAR file_name>" onLoad="scaleImg(this)" style="-ms-interpolation-mode:bicubic" GALLERYIMG="no"></p>
but if i am not wrong , you need the image mod for the above code to work

eather way , use those variables and you can do a lot of things in just html , it is way easyer then starting to edit the cgi files and then to notice that things got messed up :S


atleast this counts for versoin 1.8 :D

Greetings From PowerChaos

Jesse202
Posts: 246
Joined: May 07, 2010 6:24 pm

#3 Postby Jesse202 » Aug 13, 2012 10:19 pm

I have the image mod. It's index.cgi you need to modify. This is when you are in my files and you click export to get a mass list of links.

I'd like it to show the thumb code in the links for bb and html.

So:

Link | thumb | end link

randy
Posts: 321
Joined: Mar 13, 2012 7:00 pm

#4 Postby randy » Aug 17, 2012 3:19 am

please show me a sample url probably I can help

Jesse202
Posts: 246
Joined: May 07, 2010 6:24 pm

#5 Postby Jesse202 » Aug 17, 2012 3:29 pm


randy
Posts: 321
Joined: Mar 13, 2012 7:00 pm

#6 Postby randy » Aug 18, 2012 10:33 am

file not found?

Jesse202
Posts: 246
Joined: May 07, 2010 6:24 pm

#7 Postby Jesse202 » Aug 20, 2012 6:41 am

http://xfilesharing.com/

just upload an image

Jesse202
Posts: 246
Joined: May 07, 2010 6:24 pm

#8 Postby Jesse202 » Aug 24, 2012 5:51 am

If I'm not being clear, all I want is for it to show this code: http://i.imgur.com/mFomn.png

rather then

this: http://i.imgur.com/7Clcr.png

I do not get why this version is even doing this. I think it was 1.8 showed the first code. This one here does not make sense. People export to get thumbs and the link.

PowerChaos
Posts: 521
Joined: Dec 19, 2009 5:12 pm

#9 Postby PowerChaos » Aug 24, 2012 10:02 am

Code: Select all

<TMPL_IF thumb_url>
<div class="tabbertab">
<h2>TumbNail <TMPL_VAR lang_forum_code></h2>
<textarea id="ic3-<TMPL_VAR file_id>" style="width:98%;" cols=24 rows=3 onFocus="copy(this);">[URL=<TMPL_VAR download_link>][IMG]<TMPL_VAR thumb_url>[/IMG][/URL]</textarea>
<div id="c3-<TMPL_VAR file_id>" class="btndiv"><TMPL_VAR lang_copy_clipboard></div>
</div>
<div class="tabbertab">
<h2>TumbNail <TMPL_VAR lang_html_code></h2>
<textarea id="ic4-<TMPL_VAR file_id>" style="width:98%;" cols=24 rows=3 onFocus="copy(this);"><a href="<TMPL_VAR download_link>"><img src="<TMPL_VAR thumb_url>" border=0></a></textarea>
<div id="c4-<TMPL_VAR file_id>" class="btndiv"><TMPL_VAR lang_copy_clipboard></div>
</div>
</TMPL_IF>
can be found in download1.html

the real tumb code is

Code: Select all

<TMPL_VAR thumb_url>
enjoy
Greetings From PowerChaos

Jesse202
Posts: 246
Joined: May 07, 2010 6:24 pm

#10 Postby Jesse202 » Aug 24, 2012 12:07 pm

That would be the code for the links found at the bottom of the page. They're fine. I need to change the export links, links. That's index.cgi. I posted the code

Jesse202
Posts: 246
Joined: May 07, 2010 6:24 pm

#11 Postby Jesse202 » Aug 24, 2012 12:44 pm

I'm looking for when you click export links in the my files page. It makes no sense why it does not give a thumb url.

PowerChaos
Posts: 521
Joined: Dec 19, 2009 5:12 pm

#12 Postby PowerChaos » Aug 25, 2012 11:52 am

this is also a other option you can do

so you want to show 2 differend links right ?

use below code to create the links

Code: Select all

      push @list, $file->{download_link}; 
      push @list_bb, $file->{thumb_url} ? "[URL=$file->{download_link}]$file->{file_name} - $file->{fsize}\[\/URL]" : "[URL=$file->{download_link}]$file->{file_name} - $file->{fsize}\[\/URL]";
 
push @list_bb_tumb, $file->{thumb_url} ? "[URL=$file->{download_link}][IMG]$file->{thumb_url}\[\/IMG]\[\/URL]" : "[URL=$file->{download_link}][IMG]$file->{thumb_url}\[\/IMG]\[\/URL]"; 

      push @list_html_tumb, $file->{thumb_url} ? qq[<a href="$file->{download_link}" target=_blank><img src="$file->{thumb_url}" border=0><\/a>"] : qq[<a href="$file->{download_link}" target=_blank><img src="$file->{thumb_url}" border=0><\/a>"];

      push @list_html, $file->{thumb_url} ? qq[<a href="$file->{download_link}" target=_blank>$file->{file_name} - $file->{fsize}<\/a>] : qq[<a href="$file->{download_link}" target=_blank>$file->{file_name} - $file->{fsize}<\/a>]; 
   }  
and below code to show the links that are created with above code

Code: Select all

   print"<HTML><BODY style='font: 13px Arial;'>"; 
   print"<b>Download links</b><br><textarea cols=100 rows=10 wrap=off>".join("\n",@list)."<\/textarea><br><br>"; 
   print"<b>Forum code</b><br><textarea cols=100 rows=10 wrap=off>".join("\n",@list_bb)."<\/textarea><br><br>";

   print"<b>Forum code tumbs</b><br><textarea cols=100 rows=10 wrap=off>".join("\n",@list_bb_tumb)."<\/textarea><br><br>";
   print"<b>HTML code tumbs</b><br><textarea cols=100 rows=10 wrap=off>".join("\n",@list_html_tumb)."<\/textarea><br><br>";  

   print"<b>HTML code</b><br><textarea cols=100 rows=10 wrap=off>".join("\n",@list_html)."<\/textarea><br><br>"; 
   exit; 
}

hopely this can help
but keep in mind , it will try to give a tumb url even for normal files

Greetings From PowerChaos

Jesse202
Posts: 246
Joined: May 07, 2010 6:24 pm

#13 Postby Jesse202 » Aug 25, 2012 2:27 pm

No I just want one link. You know when you upload a image and it gives you the bb and forum code so when you post it on a forum you have a thumb showing? I want that with the extract links. Right now it shows no thumb. Just a image name. That is not good.

So when you extract many links, you should get the full bb/html code.

hmmm just gave me this:

Code: Select all

Software error:

Global symbol "@list_bb_tumb" requires explicit package name at index.cgi line 3066.
Global symbol "@list_html_tumb" requires explicit package name at index.cgi line 3068.
Global symbol "@list_bb_tumb" requires explicit package name at index.cgi line 3076.
Global symbol "@list_html_tumb" requires explicit package name at index.cgi line 3077.
BEGIN not safe after errors--compilation aborted at index.cgi line 3573.
For help, please send mail to the webmaster ([email protected]), giving this error message and the time and date of the error.
But yeah thumbs for any file is fine. All I have is image files

PowerChaos
Posts: 521
Joined: Dec 19, 2009 5:12 pm

#14 Postby PowerChaos » Aug 25, 2012 3:24 pm

that probaly means that the following code is missing that is located in the script somewhere

Code: Select all

my list_html_tumb
my skills of cgi are to low to know exact what all need
but based on those errors should it be possible to debug what parts are missing

pacakge = my
example

Code: Select all

my package = "help"
ehco package
normaly it should print out "help" as text

but i am not sure of that because i only work with php and can debug cgi a little

anyway
try to look how the other packages are created ,based on that you should be able to figure out how to create the new package to show the tumbs

Greetings From PowerChaos

Jesse202
Posts: 246
Joined: May 07, 2010 6:24 pm

#15 Postby Jesse202 » Aug 25, 2012 4:39 pm

Code: Select all

Global symbol "@list_bb_tumb" requires explicit package name at index.cgi line 3066.
Global symbol "@list_html_tumb" requires explicit package name at index.cgi line 3068.
Global symbol "@list_bb_tumb" requires explicit package name at index.cgi line 3076.
Global symbol "@list_html_tumb" requires explicit package name at index.cgi line 3077.
BEGIN not safe after errors--compilation aborted at index.cgi line 3574.
So yeah it's missing. I don't know what to do really. My cgi skills are very basic too. I'll have to see it later I guess when I have more time.

This seems like an extremely basic feature that should be here. Why it gives the thumb when you upload an image, but not here is beyond me.