vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Administrative and Maintenance Tools - Import External Images (https://vborg.vbsupport.ru/showthread.php?t=253309)

TundraSoul 06-03-2011 02:51 AM

I noticed a very small number of images are saved with some unexpected filenames. For instance: 1.gif?t=1264708348 and so on. What should I do about those, I'm fairly sure they do not work; am I correct?

BirdOPrey5 06-03-2011 10:11 AM

Quote:

Originally Posted by TundraSoul (Post 2202922)
I noticed a very small number of images are saved with some unexpected filenames. For instance: 1.gif?t=1264708348 and so on. What should I do about those, I'm fairly sure they do not work; am I correct?

It seems some places will put the question-mark and an id number or such after some images. They probably due this to better track where images are being viewed.

In almost all cases you can erase the ? and everything after it and it will still work as normal.

My "fix" for it therefore was to simply enforce the extension was only 3 characters long.

If you edit the cron file, you'll see I added a line to the function near line 124 of the file.

This is what I'm using and it's working in all the tests I've tried- again the OP please feel free to include this code in the next release if you feel it is useful.

PHP Code:

function iei_get_file_index_name($path$extension$oldfilename)
{
    
// Get only the file name (no directory info)
    
$oldfilename basename($oldfilename$extension);

    
// Strip out non alpha-numeric characters
    
$oldfilename preg_replace('#[^A-Za-z0-9_]#'''$oldfilename);

    
// Set max file name length to 40 characters
    
$oldfilename substr($oldfilename040);
    
    
// Force extension to 3 characters only
    
$extension substr($extension03);

    
//Increment number if file exists
    
for($i 1;; $i++)
    {
        
$filename "$path/$oldfilename-$i.$extension";
        if(!
file_exists($filename))
        {
            return 
$filename;
        }
    }



BadgerDog 06-03-2011 11:01 AM

Thanks BirdOPrey5 .... :)

My download of the latest version 1.0.5.iei4.zip showing the cron.php as Feb 14, 2011, already shows your changes above as being incorporated in that file?

Am I missing something? :confused:

Regards,
Doug

BirdOPrey5 06-03-2011 11:23 AM

Quote:

Originally Posted by BadgerDog (Post 2203012)
Thanks BirdOPrey5 .... :)

My download of the latest version 1.0.5.iei4.zip showing the cron.php as Feb 14, 2011, already shows your changes above as being incorporated in that file?

Am I missing something? :confused:

Regards,
Doug

It appears it wasn't the "first function" in that file but it's still there...

The relevant function included in that file is:
Code:

function iei_get_file_index_name($path, $extension, $oldfilename)
{
    // Get only the file name (no directory info)
    $oldfilename = basename($oldfilename, $extension);

    // Strip out non alpha-numeric characters
    $oldfilename = preg_replace('#[^A-Za-z0-9_]#', '', $oldfilename);

    // Set max file name length to 40 characters
    $oldfilename = substr($oldfilename, 0, 40);

    //Increment number if file exists
    for($i = 1;; $i++)
    {
        $filename = "$path/$oldfilename-$i.$extension";
        if(!file_exists($filename))
        {
            return $filename;
        }
    }
}

My change to this function is as follows (in red):

Code:

function iei_get_file_index_name($path, $extension, $oldfilename)
{
    // Get only the file name (no directory info)
    $oldfilename = basename($oldfilename, $extension);

    // Strip out non alpha-numeric characters
    $oldfilename = preg_replace('#[^A-Za-z0-9_]#', '', $oldfilename);

    // Set max file name length to 40 characters
    $oldfilename = substr($oldfilename, 0, 40);

    // Force extension to 3 characters only
    $extension = substr($extension, 0, 3);


    //Increment number if file exists
    for($i = 1;; $i++)
    {
        $filename = "$path/$oldfilename-$i.$extension";
        if(!file_exists($filename))
        {
            return $filename;
        }
    }
}

Just add those lines in red to your existing file.

BadgerDog 06-03-2011 02:08 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2203020)
It appears it wasn't the "first function" in that file but it's still there...

Just add those lines in red to your existing file.

Thanks .. :up:

Made that change ....

Regards,
Doug

y2ksw 06-04-2011 10:00 AM

Quote:

Originally Posted by Baitona (Post 2202355)
thanks :)

I am really lost of and lot of members are complaining losing their images,
the whole monthly folders are delted too not only files ....

okay what is the best way to move the imparted folder outside of the vbulletin directory?

right now it is in the basic format
images/imported -------as a result---------> domain.com/vb/images/imported

can i do it
../imported ------as a result--------> domain.com/imported

There is no way to move the imported folder out of the vbulletin directory. The only workaround would be a symbolic link (Linux).

If entire folders disappear, you have a system problem and if I was you I would concentrate on that, because it does potentially destroy your forums, too. The only other option which comes to my mind is an old cPanel version which has had a sort of inbuilt "protection", which would purge all folders which weren't built from within FTP or the cPanel. If that is the case, this option has to be disabled at least.

y2ksw 06-04-2011 10:01 AM

Quote:

Originally Posted by TundraSoul (Post 2202922)
I noticed a very small number of images are saved with some unexpected filenames. For instance: 1.gif?t=1264708348 and so on. What should I do about those, I'm fairly sure they do not work; am I correct?

Yes. I suggest to convert all imported images to JPG, which also would remove eventual tampered images. A sort of inbuilt Antivirus ... ;)

hscorp 06-08-2011 02:21 AM

any for 3.8.x?

BirdOPrey5 06-08-2011 12:41 PM

This works fine on 3.8 as is.

Scalemotorcars 07-12-2011 02:09 AM

Ok I think Im screwed here. Every single post on my site that linked to an image on my photopost is now gone. All I have now is the replacement image.

Site structure is

mysite/forum
mysite/gallery

What do I do now?


All times are GMT. The time now is 07:55 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01816 seconds
  • Memory Usage 1,761KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete