Mailing List Archive

Need sample data for image "uploads"
It has been chosen for me to not enable image uploads for regular users through the MediaWiki interface, however I still wish to allow my Wiki to use images as if they had already been uploaded. This would presumably require me to manually copy files I wish to "upload" to the /images directory (and any applicable subdirectories) and also manually create a proper entry in the "image" table in the MySQL database.

So far, my attempts to simply insert the name of the image in the img_name field and manually copy my file to "/wiki/images" have not worked. Obviously I have zero understanding of what the fields in the image table are supposed to contain.

Can somebody please post some valid data from their image table in their database along with the proper sub-directory structure beneath the "images" or "upload" directory (if applicable)?

Thanks!
Rick
Re: Need sample data for image "uploads" [ In reply to ]
Brion described it in detail in Vol 12, Issue 13. Basically, the
subdirectory an image is in is based on its md5 sum. You could hack
MediaWiki so that it does not add the sum. But Brion Vibber knows this
soooooooooooo much better than I.


On Wed, 6 Oct 2004 17:58:06 -0700, Rick Ciesla <rciesla@coupons.com> wrote:
> It has been chosen for me to not enable image uploads for regular users through the MediaWiki interface, however I still wish to allow my Wiki to use images as if they had already been uploaded. This would presumably require me to manually copy files I wish to "upload" to the /images directory (and any applicable subdirectories) and also manually create a proper entry in the "image" table in the MySQL database.
>
> So far, my attempts to simply insert the name of the image in the img_name field and manually copy my file to "/wiki/images" have not worked. Obviously I have zero understanding of what the fields in the image table are supposed to contain.
>
> Can somebody please post some valid data from their image table in their database along with the proper sub-directory structure beneath the "images" or "upload" directory (if applicable)?
>
> Thanks!
> Rick
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l@Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>


--
-------------------------------------------------------------------
http://endeavour.zapto.org/astro73/
Thank you to JosephM for inviting me to Gmail!
Re: Need sample data for image "uploads" [ In reply to ]
On Oct 6, 2004, at 5:58 PM, Rick Ciesla wrote:
> It has been chosen for me to not enable image uploads for regular
> users through the MediaWiki interface, however I still wish to allow
> my Wiki to use images as if they had already been uploaded. This
> would presumably require me to manually copy files I wish to "upload"
> to the /images directory (and any applicable subdirectories) and also
> manually create a proper entry in the "image" table in the MySQL
> database.

You might consider a slight hack to change Special:Upload from being
open to all users to being open only to administrators. This would save
the trouble of rewriting a separate tool (unless of course you want
one, say to do mass uploads easily).

Find this line in SpecialPages.php:
"Upload" => new SpecialPage( "Upload" ),
and change it to:
"Upload" => new SpecialPage( "Upload", "sysop" ),


And to hide the link from the sidebar, change this bit in
SkinPHPTal.php:
if( $this->loggedin && !$wgDisableUploads ) {
to:
if( $this->loggedin && !$wgDisableUploads && $wgUser->isSysop) {


> So far, my attempts to simply insert the name of the image in the
> img_name field and manually copy my file to "/wiki/images" have not
> worked. Obviously I have zero understanding of what the fields in the
> image table are supposed to contain.
>
> Can somebody please post some valid data from their image table in
> their database along with the proper sub-directory structure beneath
> the "images" or "upload" directory (if applicable)?

Here's what I have sitting in my 1.3 test wiki (it's just one image):
*************************** 1. row ***************************
img_name: VegTomato.jpg
img_size: 2438
img_description: dddd
img_user: 1
img_user_text: WikiSysop
img_timestamp: 20040928234934

img_user is a key to user_id; img_description is freeform text up to
255 characters. It's displayed in the revision list when you look at
the image page, and is formatted in the same way as edit comments.
img_timestamp is in the same format as our other timestamps,
YYYYMMDDHHMMSS and should be in UTC rather than local time.

img_name should not contain spaces; as with page titles, use
underscores. If you want non-ASCII characters in filenames, be sure to
use the encoding that matches what the wiki is set for (either UTF-8
unicode or 8-bit ISO 8859-1). If you're not on a standard Unix/Linux
filesystem there may be funky restrictions on non-ASCII filenames.
(Latin-1 names will not work on Mac OS X / HFS+, I haven't tested on
Windows.)

The file is at images/b/bf/VegTomato.jpg; the subdirectories are
respectively the first and first two hexademical digits of the MD5 sum
of the file name (in this case the full sum is
bf79999a6a7fe8554814185369f7017d). They're not secret, it's just to
even out the distribution so when you have 200,000 images uploaded it's
not as unwieldy to do directory listings as it might be. :)

-- brion vibber (brion @ pobox.com)
Re: Need sample data for image "uploads" [ In reply to ]
On Oct 6, 2004, at 6:14 PM, I wrote:
> And to hide the link from the sidebar, change this bit in
> SkinPHPTal.php:
> if( $this->loggedin && !$wgDisableUploads ) {
> to:
> if( $this->loggedin && !$wgDisableUploads && $wgUser->isSysop) {

Whoops, that should be:
if( $this->loggedin && !$wgDisableUploads && $wgUser->isSysop()) {

-- brion vibber (brion @ pobox.com)