plainblack.com
Username Password
search
Bookmark and Share

Importing Files

Sometimes content managers will have more files to import than you'd probably want to import via a web interface. WebGUI comes with a tool to help you out. If you type the following commands:

 

cd /data/WebGUI/sbin
perl fileImport.pl --help

 

You will see the following output:

 

Usage: perl fileImport.pl --pathToFiles=<pathToImportFiles> --configfile=<webguiConfig> --parentAssetId=<assetId>



--configFile WebGUI config file.



--pathToFiles Folder containing files to import.



--parentAssetId The asset ID of the asset you wish

to attach these files to.





Options:



--groupToEdit The group ID of the group that should

have the privileges to edit these

files. Defaults to '4' (Content Managers).



--groupToView The group ID of the group that should

have the privileges to view these

files. Defaults to '7' (Everybody).



--help Display this help message and exit.



--owner The user ID of the user that should

have the privileges to modify these

files. Defaults to '3' (Admin).



--override This utility is designed to be run as

a privileged user on Linux style systems.

If you wish to run this utility without

being the super user, then use this flag,

but note that it may not work as

intended.



--quiet Disable output unless there's an error.



--webUser The user that your web server runs as.

Defaults to 'apache'.



--skipOlderThan An interval defined in second to skip file older than.

Defaults "nothing skip".



--findByExt Import only files files with an extension matching

one of the exensions.

Defaults "import all files".



--recursive Import the files recursivelly from the folder --pathToFiles

Defaults "don't run recursivelly"



--overwrite Overwrite any matching file URL with the new file rather

than creating a new Asset for the file.

Instanciate the existing asset and replace the file.



--ignoreExtInName Title and menuTitle database fields should not contain the

extension of the filename.





EXIT STATUS



The following exit values are returned:



0

Successful execution.



1

For Windows User, stop the script if not super user.



2

A folder can't be open for reading.



3

In recursive mode, if two files has the same name and are selected to be imported. Return this error.



4

Error during invocation of the command.



5

The parent Asset Id doesn't exist.

 

Using this information you can import a whole folder full of files and images very quickly and easily. Assuming you have a bunch of files at /home/me/files and you have an asset (usually a folder) with an assetId of “39z939sjjxhhHXl-LJnn1” then you can bring all those files into WebGUI with a simple command like this:

 

cd /data/WebGUI/sbin
perl fileImport.pl --pathToFiles=/home/me/files –config=www.example.com.conf –parentAssetId=39z939sjjxhhHXl-LJnn1

 

If the folder contained a whole bunch of files and you only wanted to import the JPEGs then you could add this to the end of that command:

 

--findByExt=jpg

 

And if your folder had lots of subfolders of files you could append this to the command to have it import everything under all the folders:

 

--recursive

 

As you can see, it's very easy to import a whole bunch of files into your WebGUI site very quickly.

 

If you've already imported a bunch of images into your site, but you realized now that you wanted the thumbnails to be larger or smaller, WebGUI provides a tool for that too. Type this command:

 

cd /data/WebGUI/sbin
perl thumbnailer.pl --help

 

Will give you this output:

 

Usage: perl thumbnailer.pl --path=/path/to/files [--size=thumbnailSize] [--missing]



--path is the complete path to your uploads directory



--size=thumbSize allows you to override the default thumbnail size of 50.



--missing says to only create thumbnails for images that are missing thumbnails.

 

Therefore by using the following command you can resize all your thumbnails site-wide to 100 pixels:

 

cd /data/WebGUI/sbin
perl thumbnailer.pl --path=/data/domains/www.example.com/public/uploads --size=100

Keywords:

Search | Most Popular | Recent Changes | Wiki Home
© 2018 Plain Black Corporation | All Rights Reserved