Commit graph

98 commits

Author SHA1 Message Date
Alexandre Emsenhuber
31003d22ea Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I26a320bcddd4122ce423f536609d5794446d743e
2012-05-03 22:22:45 +02:00
Sam Reed
2ec09c5165 More return documentation 2012-02-09 21:35:05 +00:00
Aaron Schulz
436e730336 Deferred File::getLocalRef() in BitmapHandler and altered MediaTransformOutput to compensate. They were getting called on every getTransform() call, which are triggered by just looking at pages with files (like Special:ListFiles). This made page loads very slow for non-FS backends. 2012-02-01 04:44:08 +00:00
Niklas Laxström
0324d70ee5 Rm extra space 2012-01-22 12:16:47 +00:00
Aaron Schulz
5fdac785a3 In SpecialUploadStash:
* Updated outputLocallyScaledThumb() and outputLocalFile() to handle changes in r106752.
In MediaTransformOutput:
* Added a storage path field to the transformation output object and set it in  File::maybeDoTransform().
In File:
* Fixed maybeDoTransform() handling if repo member is not set and made it fully respect $wgIgnoreImageErrors.
In BitmapHandler:
* Don't set bogus path if TRANSFORM_LATER in doTransform() for deffered renderings.
2012-01-05 01:58:05 +00:00
Mark A. Hershberger
d93ece3527 * First simple XCF thumbnailing. Convert from ImageMagick has buggy
support for XCF, though, so one of the solutions at
  http://stackoverflow.com/questions/5794640/how-to-convert-xcf-to-png-using-gimp-from-the-command-line
  is probably better.

* File::maybeDoTransform() since (at least) r106752 neglects what
  BitmapHandler::getThumbType() returns, so add support for that.

* Add $wgImageMagickIdentifyCommand to avoid writing a parser for XCF
  metadata.
2011-12-27 00:46:44 +00:00
Mark A. Hershberger
e6e0baefe4 w/s 2011-12-27 00:28:23 +00:00
Aaron Schulz
5275f9b097 Merged FileBackend branch. Manually avoiding merging the many prop-only changes SVN likes to sprinkle in (easy to spot from the change list). Did not add SwiftFileBackend.php as it still is in development. 2011-12-20 03:52:06 +00:00
Sam Reed
1e2add934a Fix version check version from r105559 2011-12-08 18:07:26 +00:00
Sam Reed
16b878fdb6 Bug 32874 - Bitmap.php uses -define in ImageMagick configuration line which requires ImageMagick 6.5.6-2 but doesn't do a version check
"Patch"/Idea provided by Christian Neubauer
2011-12-08 16:18:18 +00:00
Tim Starling
33f8a6476c Fix for r101677: remove the extra parameters from the other getImageArea() callers. 2011-11-28 04:40:31 +00:00
Tim Starling
5b72053fb9 Fix for r99911: don't use getImageArea() to determine the area for comparison against $wgMaxImageArea, this breaks the $wgMaxAnimatedGifArea feature completely. 2011-11-28 04:37:15 +00:00
Bryan Tong Minh
eac3d58b44 Per comments on r99911 move $wgMaxImageArea check back to normaliseParams(). Added hook BitmapHandlerCheckImageArea to override the area check. I'm not very happy with this overly specific hook, but I don't see a clear way to obtain the functionallity required otherwise.
Remove the width and height params from BitmapHandler::getImageArea(). There is really no reason for them to be there.
2011-11-02 20:48:50 +00:00
Sam Reed
9d41b95053 Kill various unused variables
Comment some out also

Add some bits of documentation
2011-10-29 01:17:26 +00:00
Bryan Tong Minh
b6129dcde5 Per bug 28135, disable $wgMaxImageArea check when transforming using a hook, and enable the check for non IM scalers. 2011-10-15 20:36:02 +00:00
Bryan Tong Minh
11cfbad55c (bug 31487) Don't specify -auto-orient, but specify image rotations ourselves 2011-10-07 18:48:36 +00:00
Tim Starling
b9fcd0c14a Removed the redundant wfMkdirParents() call added to BitmapHandler::doTransform() in r79845. This causes problems on Wikimedia due to incorrect NFS access. If a sysadmin misconfigures their thumbnail destination directory, they should get a helpful error message, it shouldn't transparently fall back to client-side scaling and cache the resulting HTML forever. 2011-09-22 03:37:39 +00:00
Brion Vibber
cad88cae9a * (bug 6672, 31024) Fixes for handling of images with an EXIF orientation
- sets an image's reported width/height to the logical form (portait image reports itself as portait)
- everything works in logical coordinates when sizing -- we don't touch the physical pre-rotation dimensions again until it's actual low-level resize time. This fixes several problems with incorrect thumb sizing (eg getting a 600x800 image when we asked for something that fits in 800x600 box)
- fixes unit test cases in ExifRotationTest that were reporting that the width/height were coming back with the physical form which we don't want
- removes some test cases on ExifRotationTest that tested dimension swapping in a place where we don't want it
- ensures that only logical width/height need be exposed to API etc, making exif-rotated images work via ForeignAPIRepo

Note that this may actually cause file metadata to get loaded twice during File::getPropsFromPath, as the $image parameter it passes in to the handler's getImageSize function is bogus and can't be used to fetch an already-loaded metadata blob. This should not generally be too expensive though; it's not a fast path.

Rotated files that were uploaded under previous versions may still have their width/height reversed; an action=purge on the file page will refresh it and cause thumbs to be regenerated.

Follows up on r79845, r90016, r92246, r92279, r96687, r97651, r97656, r97659.

Needs merge to 1.18.
2011-09-20 22:13:34 +00:00
Brian Wolff
57228556e6 (bug 30640; follow-up r92279) Rotating images was making skewed images
This is Bryan's patch from bug 30640 with a couple minor related changes, plus some unit tests.
This also addresses an issue with preventing too-big images from being scaled from r92279.

I also noticed that image magick's rotation support is broken in 6.3.7 (the version I had installed locally. I've since upgraded) I'm not sure if we should be doing something about that...

I did test this without both image magick, and gd (although only very briefly with gd) both seemed to work well. I didn't test any other image scalars.
2011-09-09 20:13:09 +00:00
Daniel Friesen
c366b50344 Followup r93157, missing another one of the stray )'s. 2011-07-26 03:36:27 +00:00
Daniel Friesen
40989c2668 Followup r93132, misplaced ) caused 'dirname() expects exactly 1 parameter, 3 given' error. 2011-07-26 02:44:27 +00:00
Sam Reed
66e01d1bb7 Adding __METHOD__ to parameters passed to wfMkdirParents() 2011-07-25 22:01:19 +00:00
Bryan Tong Minh
0222e58b9f (bug 28762) Resizing to specified height broken for very thin images
Restructure and comment of ImageHandler::normaliseParams(). ImageHandler::normaliseParams() will now output both width/height as physicalWidth/Height, where width/height are the dimensions used by the browser, and physicalWidth/Height are the dimensions of the thumbnail that will be created. This allows keeping the use of unique dimensions for a specified thumbnail width, by forcing client side resizing of 1px-wide images with non corresponding height.
Also fixed a bug where the check for mustRender() was in an if statement where it should not have been.
2011-07-15 19:03:40 +00:00
Bryan Tong Minh
64ef056784 Follow-up r79845: Fix rotation. Turns out that we need to pass the pre-rotation dimensions to convert.exe. Also added tests. 2011-07-15 15:13:18 +00:00
Aaron Schulz
3c30666ea1 * Changed @ => wfSuppressWarnings
* Added wfSuppressWarnings to Bitmap.php:
Notice: unserialize(): Error at offset 0 of 2 bytes in D:\www\MW_trunk\phase3\includes\media\Bitmap.php on line 685
2011-05-25 00:25:29 +00:00
Siebrand Mazeland
75c6696aa8 Use consistent notation for "@todo FIXME". Should update http://svn.wikimedia.org/doc/todo.html nicely. 2011-05-17 22:03:20 +00:00
Mark A. Hershberger
653fa75fb3 Provisional fix for Bug #28631 to remove artifacts from GIF. This
seems better in my (very) limited testing than leaving it in, but I'd
like to get more tests.
2011-04-28 20:18:32 +00:00
Brian Wolff
19a66a3238 Remove the JPEG/TIFF specific metadata code from BitmapHandler and put it in JpegOrTiff handler
to stop mostly irrelevent classes from getting it.

Also remove a method that is an exact duplicate of a base class (not sure whats with that).

This also coincidently fixes the issue with when a foreign file repo uses PagedTiffHandler
and the local one does not, and the builtin Tiff handler tries to treat the metadata as if
it was its own form.
2011-04-20 23:15:13 +00:00
Sam Reed
1f86001203 Few more comment/whitespace issues from r86169 2011-04-18 13:18:15 +00:00
Sam Reed
0bd50926ca Remove some unused variables
Fix typo in wfDeprecated usage

Fix some more unreachable code
2011-04-16 11:17:14 +00:00
Brian Wolff
74f16767e7 Merge to trunk everything in img_metadata branch.
Hope I did this in an ok fashion. svn merge --re-integrate was giving me issues
so I just essentially over-wrote my working copy with the version at img_metadata.
2011-04-16 01:23:15 +00:00
Bryan Tong Minh
ef3c0a92b4 Added hook BitmapHandlerTransform to allow extension to transform a file without overriding the entire handler. 2011-03-18 22:28:19 +00:00
Bryan Tong Minh
18403736f2 Follow-up r83792: Remove left in debugging 2011-03-12 22:51:45 +00:00
Bryan Tong Minh
5e909e8090 Follow-up r83778: Need to de-rotate, so use 360 - angle instead of angle. 2011-03-12 22:50:43 +00:00
Bryan Tong Minh
8ca4667339 Fix switch fail in r83778: add missing break. 2011-03-12 21:35:27 +00:00
Bryan Tong Minh
634594c039 (bug 14706) Added support for the Imagick PHP extension. Based on patch by Leslie Hoare.
Scaler type is "imext". Rotation is supported.
Logic mostly copied from transformImagemagick() and ported to Imagick calls.
Resizing animated gifs is broken; it only shows the first frame and I can't find out why it does not work, but otherwise it is fully working.
2011-03-12 19:32:39 +00:00
Bryan Tong Minh
569546c59b (bug 27809) Check for availability of imagerotate function before using it 2011-03-02 19:42:30 +00:00
Sam Reed
dfcc5bb7fc Parameter documentation 2011-02-18 23:34:24 +00:00
Bryan Tong Minh
de79cb9cde Follow-up r79867: Read out EXIF orientation in JavaScript and rotate accordingly. Added JsJpegMeta library by Ben Leslie under the MIT license.
* Added JS variabele wgFileCanRotate. If anybody knows a way to make certain variables only available to certain modules, please tell me, could not find it.
* Added JsJpegMeta as mediawiki.util.jpegmeta
* Made BitmapHandler::getScaler and BitmapHandker::canRotate static
* Bumped style version
2011-01-22 22:34:36 +00:00
Platonides
9cd7bab807 Follow up r79845. No need to keep $wgCustomConvertCommand there. 2011-01-12 00:30:42 +00:00
Bryan Tong Minh
a00a681a5c Follow-up r79845: add function documentation; only call wfMakeDirsParent if we have a dest path.
On r79845 I submitted a wrong commit summary, here is it for reference:

(bug 6672) Images are now autorotated according to their EXIF orientation. Following the Flickr example, this only affects thumbnails, with the source unrotated.

* Introduced BitmapHandler::canRotate() and BitmapHandler::getRotation() to check if rotation is supported and what the amount of rotation is
* Factored out scaler determination into BitmapHandler::getScalerType()
* ImageMagick uses the -auto-orientation option
* GD uses imagerotate()
* Unconditionally show the thumb size on the image page, don't know why this wasn't shown for SVGs etc.
2011-01-08 11:49:09 +00:00
Bryan Tong Minh
02d3b7ad1d $wgMaxUploadSize may now be set to an array to specify the upload size limit per upload type.
Backwards compatible, if not set to an array, applies to all uploads. If set to an array, per upload type maximums can be set, using the file and url keys. If the * key is set this value will be used as maximum for non-specified types.
2011-01-07 22:12:05 +00:00
Platonides
52598e6d38 Follow up r75705 typo. 2010-12-05 15:35:57 +00:00
Roan Kattouw
04e618aad7 Fix r77261 by adding the parentheses already added in 1.16wmf4 in r77264 2010-11-25 12:34:21 +00:00
Roan Kattouw
f73704c36b Fix strange bug in ImageMagick call: if $params['comment'] was set to '' (which is explicitly done by the code in certain cases), the command line will contain -set comment -depth 8, causing the comment to be set to '-depth' and the file '8' to be read. Fix this by not adding the -set comment part at all if the comment is empty 2010-11-24 22:50:46 +00:00
Bryan Tong Minh
77304b8cc2 Follow-up r75702: change physicalSize to physicalDimensions per CR; commented getMediaTransformError function 2010-10-30 20:02:53 +00:00
Bryan Tong Minh
46b5bdfa2c Follow-up r75702: stylize 2010-10-30 19:11:30 +00:00
Bryan Tong Minh
ce7f6ec540 Split BitmapHandler::doTransform in functions: transformImageMagick(), transformCustom() and transformGd(). Pass their parameters as an options array. Put common code lines into separate functions such as getClientScalingThumbnailImage(), getMediaTransformError() and logErrorForExternalProcess(). Tested all three scalers, everything appears to be still working. 2010-10-30 19:04:26 +00:00
Platonides
3b30c2fa0e Provide a proper implementation for passing environment variables to wfShellExec()
The quick fix of r74821 is no longer needed.
2010-10-26 22:17:42 +00:00
Platonides
f91decf221 r71546 broke imagemagick usage in Windows, since cmd.exe takes the variable
names as the program name.
I'm just not exporting those variables here, but we need to support them in Windows, too.
We could use putenv() but that seems ugly (and risky). A better solution would be to have 
wfShellExec() call proc_open() with a modified environment.

A POSIX shell is required to accept variable assignments before the command so we shouldn't
have problems on any UNIX-like system.
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_09_01
2010-10-15 19:48:21 +00:00