Commit graph

471 commits

Author SHA1 Message Date
Max Semenik
da300d4432 Fix DjVu tests isolation
Change-Id: I97177572fc025c5ab4361146253d7df9c487c291
2014-07-15 16:56:34 -07:00
jenkins-bot
b15bfd99a9 Merge "Generate thumbnails based on buckets" 2014-07-09 14:09:02 +00:00
Gilles Dubuc
7036e7b68d Generate thumbnails based on buckets
Instead of always generating thumbnails based on the original,
this adds the ability to generate thumbnails based on
references buckets. The buckets themselves have their
generation chained following the same process (smaller bucket
generated based on bigger bucket). In situations where no
suitable bucket is found, the original is used, like it used to.

This is entirely optional, as most non-WMF wikis would probably prefer
to keep generating all thumbnails based on originals.

The quality implications have been verified through a survey
aimed at Commons users and people actually preferred the chained version.
Presumably due to the multiple passes of sharpening which maintained
visual details better for small thumbnail sizes.

Change-Id: I285d56b2024c81365247338f85c1e0aa708cb21e
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/600
Bug: 67525
2014-07-08 20:03:38 +00:00
jenkins-bot
345fa39378 Merge "Fix alpha transparency in XCF images" 2014-07-08 14:40:50 +00:00
umherirrender
0c1b1f8cfb Remove @private/@public/@void where visibility already set
When private is set php side on the function, no need to have it in the
param docs.

Change-Id: Ieaeac99c131b7360b1f324244d8be6f9ff854dd2
2014-07-04 22:41:05 +02:00
jenkins-bot
1ffef1a18b Merge "Don't try to render indexed xcf images with image magick." 2014-07-04 07:45:14 +00:00
umherirrender
2df720d88b Remove deprecated class FormatExif
Deprecated and warnings since 1.18

Change-Id: I2461383bb2d3c5fc00ffb5f45bc8e931ed9acb58
2014-07-04 07:12:59 +00:00
Brian Wolff
9dbc0cce8a Fix alpha transparency in XCF images
The -layers merge option flattens all layers on to a canvas
of whatever color -background is set to. However -background
was white for the PNG bKGD chunk. Set it to transparent just
for the -layers merge operation.

This works well on most recent image magick. Older image magick
explodes on my test image (I tested 6.6.0-4), so unclear if it
works there, but it certainly didn't make anything worse.
Wikimedia uses a version between the two that I tested so hopefully
this will make things better, and if it doesn't, it eventually will
when we update image magick.

Bug: 35622
Change-Id: I77601cdf005a64ae8ea7516cc846620431917863
2014-07-04 01:50:39 -03:00
Brian Wolff
22b5a763c9 Don't try to render indexed xcf images with image magick.
Image magick doesn't support them.

See some discussion at bug 35622 comment 9

Change-Id: I127bcb5458a4c06f043a4f5d0ae6d70bd7809e64
2014-07-03 23:07:38 -03:00
jenkins-bot
5141b5753b Merge "Workaround image magick issue with greyscale xcf files" 2014-07-02 13:58:28 +00:00
Brian Wolff
6f8342ed29 Some doc fixes to MediaHandler. No code changes
Change-Id: I2d79fce7aa55b9a0f2988c09a55594db4e8849f1
2014-06-20 00:45:07 +00:00
Brian Wolff
24dcc22614 Workaround image magick issue with greyscale xcf files
IM doesn't seem to properly interpret greyscale xcf files
as being greyscale. Tell it to just take the red channel
in such a case.

Bug: 66323
Change-Id: I46302d43e1029d815be99f481f3942481becd74f
2014-06-19 21:06:23 -03:00
Brian Wolff
3a4bfb597e Fix misnamed SVGHandler::canAnimateThumb()
Caused the animation warning to not be present on
image description pages

Also add unit tests. Since I'm adding an animated svg file for
this unit test, also add a metadata extraction test for animated
svgs, since we're missing one.

Change-Id: Id03e1a0e1c151d3c575a695a42c54b709187d10a
follow-up: 876128f8c9
2014-06-10 21:15:53 -03:00
jenkins-bot
edbb233e25 Merge "Reduce some code duplication" 2014-05-30 17:48:45 +00:00
Gergő Tisza
93c0954750 Allow media handlers to mark files as expensive
Allows media handlers to signal that thumbnail generation
for this file is expensive and should be throttled more agressively.
For now this is only done for large TIFF files.

Bug: 65691
Change-Id: I01b34a1d46745649f179fdee435a8cfb19c5474e
2014-05-28 20:24:31 +00:00
jenkins-bot
46e1b5f3a6 Merge "Fix doc comments on get[General](Short|Long)Desc" 2014-05-27 08:43:55 +00:00
Brian Wolff
d6b6f54caf Reduce some code duplication
MediaHandler::getLongDesc and getGeneralLongDesc have same
implementation, so forward one method to the other. Same for
short.

Also get rid of one unnecessary $wgLang global usage.

Change-Id: I688e27ce2b9cf950defa16ec6bce2e52c5959b03
2014-05-26 14:57:04 -03:00
Brian Wolff
4b0026c692 Fix doc comments on get[General](Short|Long)Desc
Follow up f3cc3980bc where somehow I managed to do this.

Change-Id: I25e5a01ddbecd1a991f6d121a7ac3f3598004b25
2014-05-24 16:10:46 -03:00
Brian Wolff
4a3ee339e4 Make sure DjVu files do not attempt metadata extraction repeatedly
If a file is broken, we don't want to spend time trying to find
its metadata over and over again.

Bug: 41090
Change-Id: Iad63b8942af99e1ec44530599a43ec1d6b2b8a62
2014-05-22 21:07:59 -03:00
jenkins-bot
a82e1acdb3 Merge "Make validation for page more strict on djvu to take only numbers" 2014-05-15 21:44:57 +00:00
Brian Wolff
552b6a12e1 Make validation for page more strict on djvu to take only numbers
This change causes wiki syntax like
 [[File:Foo.djvu|thumb|Page 7 of document]]
to be interpreted as a caption instead, of saying select page 7
of the djvu. Previously it eventually ran intval( '7 of document' ),
so flipped to page 7.

Only possible downside I could see is this would cause things like
left-to-right marks and weird unicode spaces to no longer be ignored.
I don't think that's a big deal.

Change-Id: Ie8c953009a38557876a274bf0f71ab470f66ef4e
2014-05-14 21:48:43 -03:00
Aaron Schulz
5255476305 Fixed "file already exist" optimization in File::transform()
* Previously, the resulting thumbnail did not handle hasFile() and
  stream() properly. This effected doCachedWork() in thumb.php

Change-Id: I8fd025204b5b41472be6c09924892fe8ee9dd260
2014-05-13 16:07:15 -07:00
Brion VIBBER
7bbc880626 Merge "Allow mobile to reduce image quality" 2014-05-09 21:50:47 +00:00
Yuri Astrakhan
a77032257f Allow mobile to reduce image quality
http://www.mediawiki.org/wiki/Requests_for_comment/Reducing_image_quality_for_mobile

Per above RFC, this patch implements the core changes required to
specify quality reduction of JPEG via URL. To test, make sure your
setup uses 404-based thumb generation. Vagrant supports it by adding
"multimedia" role:  $ vagrant add-role multimedia && vagrant provision
* Pick any thumbnail jpeg URL that exists on the test wiki, e.g.
  http://.../images/thumb/4/49/Img.jpg/400px-Img.jpg
* check that basic scaling works by altering 400
* add quality parameter qlow- right before px:
  http://.../images/thumb/4/49/Img.jpg/qlow-400px-Img.jpg

Change-Id: I930ea06be6d302ffc8832d12b251422a9f1b3e75
2014-05-09 16:39:54 -04:00
Siebrand Mazeland
f994817f6b Pass phpcs-strict on various files in includes/
These files have all had treatment before, and these occurrences have either
been missed or have been introduced after.

Change-Id: I06cdab4616b5bff47c85152df28f18c861730a23
2014-04-24 21:50:01 +02:00
umherirrender
23bb3d1cb4 Follow-Ups to "Fixed some @params documentation"
Fix of inline comments of the following patch sets:
Follow-Up: I0056b4a8df243cfc0c5f25378de48f7a35170aca
Follow-Up: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
Follow-Up: I3622f216a2ca8ac1b5e51892be9f98665f65bc36
Follow-Up: I6627ba0e76d3577c40bf2473e0f78a5ad7368634
Follow-Up: Id75b5ecf648ca50f955b3bde3307c82c4366b102
Follow-Up: I4ca5231119f33039d91da3b57a41cd40719a576b

Change-Id: Id9bbe84b2820e9db44af5783411e955f55f643d4
2014-04-23 13:39:49 +02:00
umherirrender
8ad1c92441 Fixed some @params documentation (includes/*)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
2014-04-20 21:16:57 +02:00
jenkins-bot
e95cb3f6a2 Merge "Wrap djvu large local copy downloads in pool counter" 2014-04-13 22:30:40 +00:00
Aaron Schulz
6f3836da79 Wrap djvu large local copy downloads in pool counter
Change-Id: I3cade9d870f7c344434d7cee27506d53345ebdf9
2014-04-11 16:05:12 -07:00
Brian Wolff
1f995639ea Make DjVu metadata be stored as serialized PHP array.
Previously metadata was stored as a string of XML. Some of the
code in File expects the metadata to be an array serialized using
PHP's serialization format. In particular, this fixes the api
query=imageinfo module, and by extension instantCommons.

This supersedes Icaa16eeb

Bug: 37764
Change-Id: I5c1d2d2434f70b57137837bade797d4133c47b70
2014-04-11 21:50:08 +00:00
jenkins-bot
bc1cd69a59 Merge "Replace in_array( array_keys( ... ) ) with array_key_exists( ... )" 2014-04-07 23:16:46 +00:00
umherirrender
edbd8ea6b3 Fix [missing] variables in @param docs
Two places found without variable, one without $ and one only missed a
space before $

Change-Id: Iacd7c386d57223f3a112b59cd11383ef5c0ac2f1
2014-04-06 20:11:30 +02:00
umherirrender
23fab68274 Fix spacing after @param and friends in comments
Searched for:
\@(param|return|throws|since|deprecated|access|todo|var)[ \t]{2,}

Change-Id: Icce22ba9fe0635455691ca58d9872d618151f346
2014-04-05 20:02:29 +00:00
Thiemo Mättig
d0dbbc376c Replace in_array( array_keys( ... ) ) with array_key_exists( ... )
It's the same, right? in_array() must search for a value and therefor
is expensive. array_key_exists() searches for a key and should be
much cheaper. Also easier to read.

Change-Id: Ide17d5af13c416c62a40029848ac17ba24eb5563
2014-04-01 23:44:03 +02:00
Gilles Dubuc
29044d760f Expose thumbnail file to extensions
This is needed by Media Viewer in order to display a placeholder
image as soon as possible

See https://gerrit.wikimedia.org/r/#/c/121613/

Change-Id: I3dfa80b02073984dc2d3d7784cb3744b7e4e2cc8
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/293
2014-03-28 11:09:36 +01:00
Brian Wolff
8d0f7a0ec3 Add default implementation of getLength to base MediaHandler class
It was being called in File::getLength, but was only implemented
in a subclass, that's not even in core. Any method of a handler
class called from a method in File class should work on any
subclass of MediaHandler.

Change-Id: I94eda90ec3dd64b6ff2e3a5732aa539366cec521
2014-03-24 00:05:39 -03:00
Ladsgroup
a90f1a2d79 Changing URLs of mediawiki.org in scripts to the SSL-based website
http://www.mediawiki.org --> https://www.mediawiki.org

Part 3

Change-Id: Ica633881b1744fa2854f4b012b79dbf5a7e5e7e2
2014-03-13 22:28:14 +00:00
umherirrender
be004b1647 Remove another undefined $env and TODO comment for it too
Follow-Up: Ie69a68c8ff429ac79796890d1843cf2a2b9c32e8
Change-Id: I767cb09215f8b51a9e88c770d3b0f87c37452d00
2014-03-02 22:14:22 +00:00
Reedy
e8ff01276c Remove undefined $env and TODO comment for it too
Change-Id: Ie69a68c8ff429ac79796890d1843cf2a2b9c32e8
2014-02-20 03:47:25 +00:00
Alexandre Emsenhuber
8d701eeeea Remove trailing line breaks from wfDebugLog() messages
This is useless since the message is passed through trim() and a
line break is added afterwards.

Change-Id: I1a26b30a07f7c9c749fce5bb6b2b4b3d79901b7c
2014-02-04 22:16:13 +01:00
Tim Starling
2d3ffcc316 SECURITY: Sanitize shell command args
Add validation and sanitization to several code paths.

Bug: 60339
Change-Id: Id124281d21ec730a2e0bbace843dd97194a712b4
2014-01-29 10:26:50 -08:00
Aaron Schulz
0177cb82cd Improved vague/incomplete $1 thumb.php error messages
Change-Id: I64d05e25f82242e92abbcbf20252fc17d5790d8b
2014-01-17 18:20:17 -08:00
Siebrand Mazeland
bca6b406c9 Remove Exif::makeFormattedData and Exif::getFormattedData
Both unused in core and Gerrit extensions.
Deprecated since MediaWiki 1.18.

Change-Id: I59e9bb5a368ffcbae1634395c0062fea0e754972
2013-12-27 17:11:06 +01:00
Aaron Schulz
875a597e7f Move BitmapHandler::canRotate() call out of Setup.php
* This was wasting 5ms on every request hit on test wiki

Change-Id: Ie7a5aa27593ab8e0d52fb00218345d1789da61a1
2013-12-21 21:44:30 -08:00
jenkins-bot
fc56c63e2c Merge "Make SVG language selector "use default lang" actually work" 2013-12-18 00:13:09 +00:00
Brian Wolff
acb83faa0a Make SVG language selector "use default lang" actually work
Also have ImagePage check that the given language is actually
valid, before trying to transform with that language.

Change-Id: I62b8035b70f5cb3388f4c2a844f3bc1c7c92d01e
2013-12-17 23:57:26 +00:00
umherirrender
2e871f7087 Fixed spacing
- Removed double spaces in arrays
- Added space after for
- Added spaces around string concat

Change-Id: Ifbcaf35f9bfef1f97226a38b5bd74c237f61c99e
2013-12-15 20:56:09 +01:00
Siebrand Mazeland
a521ef001e Make visibleMetadataField protected
Related patch sets:
* https://gerrit.wikimedia.org/r/#/c/99429/ Extension PagedTiffHandler

Change-Id: I0441fdf1ce1e06688f16c62e1993bb05911b45bc
2013-12-14 05:33:33 +00:00
Brian Wolff
751b9ebab8 Add method to get entire text layer. This could be useful for search
Change-Id: I22f5fc47aef3cf362cdf630980deea48fe531d45
2013-12-13 18:02:01 -05:00
umherirrender
661c5c3f01 Fixed spacing
- Added space after foreach
- Added/Removed spaces inside arrays

Change-Id: Ia8775824fa33976b1a4dab43e07f1bff0c57479c
2013-12-08 20:31:47 +01:00