Commit graph

69 commits

Author SHA1 Message Date
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
Sam Reed
5583dacd0a Followup r72238, remove & 2010-09-03 16:00:58 +00:00
Sam Reed
9b52cb83b1 Add some $retval = '' before some wfShellExec 2010-09-02 22:15:20 +00:00
Tim Starling
93565e3f82 Fixes for new ImageMagick:
* (bug 24824) Support ImageMagick 6.5.6-2+ JPEG decoder size hint, to reduce memory usage when such an ImageMagick is used for scaling.
* Removed -size option since it doesn't act as a JPEG decoder size hint with recent ImageMagicks, and it may cause undesired behaviour in the future since it's documented to do something different now.
* Disable multithreaded behaviour in recent ImageMagick, to avoid a deadlock when a resource limit such as $wgMaxShellMemory is hit.
* Fixed some comments.

Replaces WMF live hack.
2010-08-24 08:48:46 +00:00
Derk-Jan Hartman
60ba8d53a7 Optimize a produced animated GIF with OptimizeTransparency, better would be to use optimize, but it breaks transparent GIFs. Fixes Bug 11822.
Only add animated gif options for animated gifs.
2010-08-20 13:37:20 +00:00
Derk-Jan Hartman
5a8ff385de Add getMagickVersion(). Will use this to provide optimization of animated gifs. 2010-08-20 13:22:02 +00:00
Ryan Kaldari
a6987c7781 reverting self (r71304) 2010-08-19 18:40:47 +00:00
Ryan Kaldari
1c6b47eb96 changing -sharpen to -unsharp due to new ImageMagick syntax, bug 24857 2010-08-19 18:21:06 +00:00
Alexandre Emsenhuber
320d4e1374 * Standardised file description headers
* Added some descriptions
2010-08-15 17:27:41 +00:00
Chad Horohoe
88fd6d25ab Don't use @, use wfSuppress/RestoreWarnings 2010-06-09 10:15:19 +00:00
Tim Starling
41a4e0ea85 More rigorous fix for ImageMagick parameter interpretation (bug 23148 etc.) based on examination of the source code, updating r64932. The source was large and complex and I might have missed some bits, but this is my best guess for now.
Tested bug 23148 and wildcards in filenames (was broken) using a patched convert. With a manual unit test (no convert), tested all branches of the new functions except wfIsWindows() == true.
2010-04-23 16:24:54 +00:00
Platonides
b378be4dd6 Follow up r64936. Even better, provide the bug number and imagemagick doc page. 2010-04-11 20:47:41 +00:00
Bryan Tong Minh
e8881b2a66 Follow up r64935: Add whitespace and clarify comment a bit more. 2010-04-11 13:59:01 +00:00
Bryan Tong Minh
879abd9113 Follow up r64932: Add comment on why % is escaped 2010-04-11 13:54:22 +00:00
Roan Kattouw
b8e3b0cb06 (bug 23148) Escape % in ImageMagick comments. Patch by Derk-Jan Hartman 2010-04-11 12:38:28 +00:00
Ilmari Karonen
9686c4bf20 (bug 23063) Reverse handling of $wgMaxImageArea and $wgMaxAnimatedGifArea: the former is now compared to the size of the first frame and the latter to the total size of all frames. Also increase default value of $wgMaxAnimatedGifArea to match $wgMaxImageArea. This change should not affect the thumbnailing of non-animated images in any way.
The way the logic and the defaults were before, it was basically impossible for animations with more than 12 frames to reach the "only thumbnail first frame" codepath; this surely cannot have been intended.
Also mention r64691 in release notes.
2010-04-07 05:41:44 +00:00
Ilmari Karonen
daba9d9160 allow display of unscaled image even if it exceeds $wgMaxImageArea (this can happen with animated GIFs, see bug 23063) 2010-04-07 05:17:19 +00:00
Raimond Spekking
3a188007c7 Follow-up r60175: Avoid PHP Notice: Undefined index: descriptionUrl in /var/www/w/includes/media/Bitmap.php on line 63 2009-12-17 22:54:55 +00:00
Raimond Spekking
c690e3c2af * (bug 19791) Add URL of file source as comment to thumbs (for ImageMagick) 2009-12-17 20:25:55 +00:00
Brion Vibber
787ff66c85 Revert image crop for now:
r54746 "Update formatting for r54745"
r54745 "Added crop support for inline images."
r54748 "Making demon happy (adding public/protected to function definitions) and add some comments along the way."

Several issues:
* Implementation is ImageMagick-specific, no support for GD backend
* Specification syntax is pretty ugly and non-obvious imo... [[File:foo.jpg|<width>px|<left>x<top>x<width>x<height]]
* Crop syntax seems to be tied to pixels... I _presume_ source pixels? This would break if a file is re-uploaded with a new size.
* In general I'm very leery of tacking on more infinite-options-in-infinte-combinations for image rendering; our treatment of resizing already has implications for CPU and disk usage and this just adds another level of arbitrary-rendered horror. ;)

I'd much rather we move towards limiting the number of rendered variants we have, not increase them... IMO cropping would be better served with an interface allowing for explicit, visible cropping which creates either a new saved version, or a 'cloned' virtual file which can be referred to by name... and more importantly, uses of it would be trackable so that if crops needs to be updated they can be cleanly.
2009-08-19 02:07:00 +00:00
Bryan Tong Minh
56d3a70695 Making demon happy (adding public/protected to function definitions) and add some comments along the way. 2009-08-10 21:16:33 +00:00
Bryan Tong Minh
bcb8ad6d6b Added crop support for inline images.
Syntax: [[File:foo.jpg|<width>px|<left>x<top>x<width>x<height]]
2009-08-10 21:02:24 +00:00
Andrew Garrett
e5343317b8 (bug 16451) Fix application of scaling limits for animated GIFs.
* Creates a new media handler for GIF files, and extracts metadata such as duration, whether or not the GIF is looped, and the number of frames.
* Uses the extracted metadata for the long file description.
* Considers number of frames in the calculation of image area (multiplies by width and height to get the "time-area", or so to speak).

After this patch is deployed, the work-around to disable GIF scaling on Wikimedia sites can be eliminated.
2009-08-03 15:01:51 +00:00
Tim Starling
88bc7329b7 Revert r49677, r50459, Brent G's patch for fixing GPS coordinates in EXIF. As I noted on CodeReview, there's a possibility it could crash the site on deployment. As much as it looks useful, I don't fancy spending part of my weekend rewriting it to preserve backwards compatibility, and the committer hasn't responded to the last couple of CR comments. 2009-06-06 15:48:06 +00:00
Ilmari Karonen
2364bc8edb fix regression from r49677 by refusing to format old-style metadata even if a foreign repo hands us some 2009-05-10 20:33:55 +00:00
Ilmari Karonen
4f738da210 Apply patch for bug 13172 by Brent G <overlordq@gmail.com> with minor modifications.
Also add pretty-printing of GPS coordinate values and correct display of altitude / destdistance reference values.
(We really should redesign the FormatExif class so that the "GPS*Ref" values can be combined with their parent values, but this will do for now.)
2009-04-20 22:29:40 +00:00
Raimond Spekking
e5fe5ab87a Follow up r49442: Make this new error message and two older error messages localizable. 2009-04-15 19:41:00 +00:00
Chad Horohoe
bee2293cbe If the file doesn't exist, we get a whole bunch of cascading PHP errors. 2009-04-13 15:05:47 +00:00
Andrew Garrett
0aadb0a8cc Tweak r47992 to use instead of a new configuration variable. Also moved its precedence higher to make its behaviour more logical. 2009-03-25 06:00:36 +00:00
Chad Horohoe
27f5871373 (bug 12970) Add global to force client rendering of thumbs. Helpful for victims of safe_mode which can break thumbnailing Very Badly. 2009-03-03 21:21:16 +00:00