Hello, very useful mailing list here.
Question:
Does anyone have a workable method for uploading multiple files (images in my case) to wiki? I have a ton of images and I'd like to set up a <gallery></gallery> with them, but doing it piecemeal just isn't going to work. I need to upload them as a batch (either by selecting all the images at once or selecting their parent folder).
The overall idea is that I'd like users to see a very large list of images, be able to click on any image, and then comment on it. It all seems workable except the part about actually getting the images into wiki and automatically building the gallery page :).
Is there php that would support this? Has anyone successfully added this data directly to mysql? I'm a little lost.
Thanks!
Bart
On Friday 18 February 2005 16:03, Bart Q. Simon wrote:
The overall idea is that I'd like users to see a very large list of images, be able to click on any image, and then comment on it. It all seems workable except the part about actually getting the images into wiki and automatically building the gallery page :).
i don't think a wiki is the right tool for something like this ...
try something like this: http://coppermine.sourceforge.net/
in action it looks like this:
http://www.calcutta-project.ch/galleries/index.php
hope it is usable input,
Damir Perisa
When this question was asked before, Brion recommended this:
http://sourceforge.net/projects/pywikipediabot
I have no idea how it applies, but maybe it will help. Michelle
On Feb 18, 2005, at 7:03 AM, Bart Q. Simon wrote:
Hello, very useful mailing list here.
Question:
Does anyone have a workable method for uploading multiple files (images in my case) to wiki?
I asked a similar question a few days ago, and got no response.
Pywikimediabot looks like it's a framework for writing http client bots which manipulate a wiki.
What I'm looking for is a start on writing server side tools instead of client bots.
I've already got a lot of image files on the server where my wiki is running which I'd like to "upload" without going through the web interface. What I've got in mind is a tool which I can give a list of image files to, and which will move or copy them to the right place, and do the sql work to build the image pages. The image description could be a simple default, or might come from an auxiliary file which I could make up with a text editor, and then let the tool run while I'm taking a nap <G>.
Has anyone done anything like this, or anything with server side mediawiki tools in general?
On Fri, 18 Feb 2005 08:37:38 -0800, Michelle mme2002@earthlink.net wrote:
When this question was asked before, Brion recommended this:
http://sourceforge.net/projects/pywikipediabot
I have no idea how it applies, but maybe it will help. Michelle
On Feb 18, 2005, at 7:03 AM, Bart Q. Simon wrote:
Hello, very useful mailing list here.
Question:
Does anyone have a workable method for uploading multiple files (images in my case) to wiki?
MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
MediaWiki is written in PHP, using MySQL functions. You certainly can write server-side tools using PHP.
If you look in the "maintenance" directory of the MediaWiki software you can find some examples of tools that update the database.
-Rich Holton
On Fri, 18 Feb 2005 12:27:58 -0500, Rick DeNatale rick.denatale@gmail.com wrote:
I asked a similar question a few days ago, and got no response.
Pywikimediabot looks like it's a framework for writing http client bots which manipulate a wiki.
What I'm looking for is a start on writing server side tools instead of client bots.
I've already got a lot of image files on the server where my wiki is running which I'd like to "upload" without going through the web interface. What I've got in mind is a tool which I can give a list of image files to, and which will move or copy them to the right place, and do the sql work to build the image pages. The image description could be a simple default, or might come from an auxiliary file which I could make up with a text editor, and then let the tool run while I'm taking a nap <G>.
Has anyone done anything like this, or anything with server side mediawiki tools in general?
On Fri, 18 Feb 2005 08:37:38 -0800, Michelle mme2002@earthlink.net wrote:
When this question was asked before, Brion recommended this:
http://sourceforge.net/projects/pywikipediabot
I have no idea how it applies, but maybe it will help. Michelle
On Feb 18, 2005, at 7:03 AM, Bart Q. Simon wrote:
Hello, very useful mailing list here.
Question:
Does anyone have a workable method for uploading multiple files (images in my case) to wiki?
MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
On Fri, 18 Feb 2005, Rick DeNatale wrote:
I asked a similar question a few days ago, and got no response.
Pywikimediabot looks like it's a framework for writing http client bots which manipulate a wiki.
I think that currently the pywmbot toolkit is the only "api" for mediawiki.
It contains a upload.py script, which does the trick. Before I used that one I wrote a little perl script to do the same thing.
I used upload.py to upload the images for http://krass.com/ which was converted from a more or less static gallery to mediawiki.
christof
Hope my script helps
Bart Q. Simon wrote:
Hello, very useful mailing list here.
Question:
Does anyone have a workable method for uploading multiple files (images in my case) to wiki? I have a ton of images and I'd like to set up a <gallery></gallery> with them, but doing it piecemeal just isn't going to work. I need to upload them as a batch (either by selecting all the images at once or selecting their parent folder).
The overall idea is that I'd like users to see a very large list of images, be able to click on any image, and then comment on it. It all seems workable except the part about actually getting the images into wiki and automatically building the gallery page :).
Is there php that would support this? Has anyone successfully added this data directly to mysql? I'm a little lost.
Thanks!
Bart
<html> <body> <?php /* Help the batch upload images from Dokuwiki to Mediawiki INspired from: 1 - mediawiki/include/specialUpload.php 2 - mediawiki/include/globalFunctions.php line 480 function wfImageDir( $fname )
You need: 1) to put all the image files in the same directory (no more sub directories). That means that you must rename your file who have the same names, to avoid any conflict. The best way is maybe to create a script which will add the subdirectories names to the image name. */ $filePathIn = "C:/Fxp/Prog/wikis/Mywiki/media"; $baseFileIn = "C:/Fxp/Prog/wikis/Mywiki/media"; $baseFileOut = "C:/apachefriends/xampp/htdocs/wikis/media4"; recurseAction($filePathIn);
function recurseAction($filePathIn){
global $baseFileIn,$baseFileOut;
$replace = false; $target = "db"; // file oder db $dh = opendir($filePathIn) or die("couldn't open directory");
while (!(($file = readdir($dh)) === false)) { if (is_dir("$filePathIn/$file") & (!(($file==".")|($file=="..")))) { print "<b>$file</b><br />\n"; print "<u>$filePathIn/$file</u><br />\n"; recurseAction("$filePathIn/$file"); }
elseif (is_file("$filePathIn/$file") & (!(($file==".")|($file=="..")))) { $fileName = "$file"; //$filePathIn = "C:/Fxp/Prog/wikis/Mywiki/media"; list($filename, $fileext) = explode(".", $fileName); $file = "$filePathIn/$file";
if ($fp = fopen($file, "r")) { $count++; //$baseName = basename($file);
$baseName = str_replace($baseFileIn."/","", $file); $baseName = str_replace('cib/', '', $baseName); $baseName = str_replace('/', ' ', $baseName); $baseName = preg_replace("/([a-z])([A-Z])/", "$1 $2", $baseName); $baseName = preg_replace("/([a-zA-Z])([\d])/", "$1 $2", $baseName); $baseName = preg_replace("/([\d])([a-zA-Z])/", "$1 $2", $baseName); $baseName = str_replace("_", " ", $baseName); $baseName = preg_replace("/([A-Z:])([A-Z][^A-Z])/", "$1 $2", $baseName); $baseName = ucwords($baseName); print "<i>$baseName</i>"; $baseName = str_replace(' ', '_', $baseName);
$hash = md5( $baseName ); $oldumask = umask(0); $wgUploadDirectory = 'C:/apachefriends/xampp/htdocs/wikis/mediawiki-1.3.9/images'; $dest = $wgUploadDirectory . '/' . $hash{0}; if ( ! is_dir( $dest ) ) { mkdir( $dest, 0777 ); } $dest .= '/' . substr( $hash, 0, 2 ); if ( ! is_dir( $dest ) ) { mkdir( $dest, 0777 ); }
$newfile= "$dest/$baseName"; $myfile= "$file"; copy($myfile, $newfile); echo "$newfile<br />";
$filename2 = preg_replace("/([a-z])([A-Z])/", "$1 $2", $filename); $filename2 = str_replace("_", " ", $filename2); $filename2 = preg_replace("/([A-Z:])([A-Z][^A-Z])/", "$1 $2", $filename2);
if (($target == "db")|($target == "both")){ // process form $db = mysql_connect("localhost", "root", "xxxxx"); $creator = "admin"; mysql_select_db("wikidb",$db); if ($replace){ $sql = "DELETE FROM tiki_pages WHERE pageName = '$baseName'"; $result = mysql_query($sql); $err = mysql_error(); printf("Erased: $baseName -- $err<br />\n"); } $sql = "INSERT INTO cur (cur_namespace, cur_title,cur_text, cur_timestamp) VALUES('6','$baseName','$filename2', now()+0)"; //echo = "Query: $result = mysql_query($sql); //$result = mysql_query($sql)or die(mysql_error()); $err = mysql_error(); printf("$count: $baseName...$err<br />\n"); }
elseif(($target == "file")|($target == "both")){ $outputDir = "/out2/"; $outputFile = ($outputDir . $baseName.".txt"); $out = fopen($outputFile, "w"); fwrite($out,$strFile); printf("$count: $baseName ...$err<br />\n"); }
}
} }
} ?> </body> </html>
mediawiki-l@lists.wikimedia.org