aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/img.pm
Commit message (Collapse)AuthorAge
* img: Explicitly detect format if neededSimon McVittie2018-02-28
| | | | | | | | | | An empty coder name used to detect the format implicitly, but has been interpreted as a literal part of the filename since ImageMagick 6.9.8-3. In newer versions, there does not seem to be any way to indicate that a filename containing ':' is to be taken literally without first knowing the decoder to use. Signed-off-by: Simon McVittie <smcv@debian.org>
* img: resize images in a deterministic manner.intrigeri2017-09-01
|
* Detect image type from .JPG just like .jpg (etc.).Amitai Schlair2016-05-08
|
* img: make img_allowed_formats case-insensitiveSimon McVittie2016-05-07
|
* img: Add back support for SVG images, bypassing ImageMagick and simply ↵Simon McVittie2016-05-06
| | | | | | | | | | | | | | passing the SVG through to the browser SVG scaling by img directives has subtly changed; where before size=wxh would preserve aspect ratio, this cannot be done when passing them through and so specifying both a width and height can change the SVG's aspect ratio. (This patch looks significantly more complex than it was, because a large block of code had to be indented.) [smcv: drop trailing whitespace, fix some spelling]
* img: check magic number before giving common formats to ImageMagickSimon McVittie2016-05-05
| | | | | This mitigates CVE-2016-3714 and similar vulnerabilities by avoiding passing obviously-wrong input to ImageMagick decoders.
* img: restrict to JPEG, PNG and GIF images by defaultSimon McVittie2016-05-05
| | | | | | This mitigates CVE-2016-3714. Wiki administrators who know that they have prevented arbitrary code execution via other formats can re-enable the other formats if desired.
* img: force common Web formats to be interpreted according to extensionSimon McVittie2016-05-05
| | | | | | | | A site administrator might unwisely set allowed_attachments to something like '*.jpg or *.png'; if they do, an attacker could attach, for example, a SVG file named attachment.jpg. This mitigates CVE-2016-3714.
* img: stop ImageMagick trying to be clever if filenames contain a colonSimon McVittie2015-06-13
| | | | | | | | | | $im->Read() takes a filename-like argument with several sets of special syntax. Most of the possible metacharacters are escaped by the default `wiki_file_chars` (and in any case not particularly disruptive), but the colon ":" is not. It seems the way to force ImageMagick to treat colons within the filename as literal is to prepend a colon, so do that.
* img: raise an error if we cannot find the image's sizeSimon McVittie2014-09-16
| | | | This happens for PDFs without ghostscript installed, for instance.
* show resized img in preview using data: urlschrysn2014-07-15
| | | | | | | | in analogy to sparklines, this renders scaled imgs to data:img/...;base64,... urls in preview mode. if the image is already present on the server (eg because it was not just inserted), the already rendered image is referenced instead.
* img plugin: split resizing calculations and actual resizingchrysn2014-07-15
| | | | | | | | | | | | | | | | | | | | | | there is now a size calculating part (which chooses a final size) and a scaling part (which triggers if the sizes calculated by the former indicate a downscaling). this solves the issue of unproportional upscalings (bugs/image_rescaling_distorts_with_small_pictures). also, "small" pdf files (or pdf files without explicit size settings), which would not be converted under the old mechanism, now get rendered to pngs. this commit affects a unit test: while svgs were previously unconditionally rendered to pngs, this now only happens on downscaling. this is intentional -- while a small version of an svg graphic is likely to be more compact when rendered (eg as a preview), a large version would not have that benefit, and why convert something that browsers basically can show and be inconsistend with how other images are handled. the new unit test simply makes the original svg larger to check for the same behaviros as before.
* add pagenumber parameterchrysn2014-04-07
| | | | | | | | | | this allows picking a page from a pdf. also, this enhances performance greatly when rendering pdfs, as only the first page is rasterized. (otherwise, imagemagick would treat the pdf as a list of images, work with all of them, until finally only the first page gets saved). the default parameter of 0 will select the single image contained in typical image files anyway, so no specialcasing between single- and multifile containers is needed.
* add pdf support to the img directivechrysn2014-04-07
| | | | | this is trivial as pdf is supported by imagemagick, and just needs an explicit mention to enable conversion.
* set the file type parameter after reading the imagechrysn2014-04-07
| | | | | | | | | | imagemagick, when reading an image, sets its magick parameter to indicate the file type, overriding the explicitly set file type for output if it is set at creation. as a result, previously (with graphicsmagick-libmagick-dev-compat 1.3.18-1 providing Image::Magick), svg output files were not png, neither svg, but mvg (imagemagick vector graphics).
* cleanup now unused settingJoey Hess2011-11-17
|
* Always use true image sizePer Carlson2011-11-17
|
* img: Generate png format thumbnails for svg images.Joey Hess2011-06-29
| | | | | | | | | | | Imagemagick does not generate svg images very well, but it can convert them to png quite well. For browsers that don't yet support displaying svg, this also provides a workaround; just scale the svg down to get a png. But the workaround is partial, since scaling the image larger, or leaving it the same size will cause the original svg to be displayed. Since browsers are actively improving svg support, this is good enough for me.
* use one-parameter form of urltoJoey Hess2010-11-29
|
* Use local paths for most references to pagesSimon McVittie2010-11-23
|
* img: If a class is specified, don't also put the img in the img class.Joey Hess2010-10-13
|
* img: Add a margin around images displayed by this directive.Joey Hess2010-07-05
| | | | | Particularly important for floating images, which could before be placed uncomfortably close to text.
* avoid ugly warning if size="" is specifiedJoey Hess2010-06-12
|
* img: Support hspace and vspace attributes.Joey Hess2010-06-12
|
* improve preview mode commentsJoey Hess2010-06-09
|
* img: Fill in missing height or width when scaling image.Joey Hess2010-06-08
|
* setup file orderingJoey Hess2010-02-12
|
* img: Fix a bug that could taint @links with undef values.Joey Hess2010-01-28
|
* only use css alignment stuff for tableJoey Hess2010-01-07
| | | | | | This way users can use all the other alignment values when not including a caption. Also, it will work without the standard style, and I don't have to worry about regressions this way.
* img: remove special case handling of link=yesJoey Hess2010-01-07
| | | | Only exists as an undocumented backwards compatability hack.
* refactorJoey Hess2010-01-07
|
* brace styleJoey Hess2010-01-07
|
* Support align attribute for img with captionGiuseppe Bilotta2010-01-06
| | | | | | This is achieved by preparing CSS definitions that emulates the behavior of the align attribute, and passing it to the outermost IMG wrapper (A or TABLE) instead of passing the align value to IMG directly.
* img: use presence dependency when linking to a pageJoey Hess2009-10-09
|
* img: Fix dependency code for full size images.Joey Hess2009-09-27
| | | | | | | | I had assumed that an image shown full size did not need add_depends, since a change would not need a change to the displaying page. But this is not true if the image is modified and its size changes. Then the page needs to update its img tag to reflect the current size.
* img: Correct bug in image size calculation code.Joey Hess2009-09-27
| | | | | | | | | | | | | | | | If an image was resized smaller, with width and height specified to values that did not fit its aspect ratio, the image tag with/height were not adjusted to the actual size imagemagick chooses. This was broken by 03449610d6c666ba24bea68f01d896613e522278. To fix it right, it unfortunatly needs to always read the src image now, in order to determine if the image is being displayed larger, or resized smaller. When resized smaller, it then always uses the size of the thumbnail, while for larger it calculates the size. (Only way to get rid of this sometimes extra image read would be to change it to not allow displaying images larger.)
* img: Don't generate new verison of image if it is scaled to be larger in ↵Joey Hess2009-08-28
| | | | | | | | either dimension. Although imagemagick handles even really large sizes sanely, using a page file, doing so would just waste time and disk space, since the browser can be told to resize it larger.
* img: depend on absolute page name, not relativeSimon McVittie2009-08-15
| | | | | | | Previously, [[!img bar.jpg]] on foo, where foo/bar.jpg exists, would get a dependency equivalent to "glob(bar.jpg)" (which might not match anything), rather than the correct "glob(foo/bar.jpg)". (cherry picked from commit 85b2ec49ecd12dd23e5c432933457a72744ce7cb)
* img: Fix adding of dependency from page to the image.Joey Hess2009-07-27
| | | | | | | | | This was impressively broken. add_depends was being called with params backwards, and on parameter was set to the name of the generated file, which isn't in the source. Now updates to images will update the page that contains them, thus updating them. This is unncessary for fullsize images, so skipped.
* improve error messageJoey Hess2009-07-19
|
* img: Pass the align parameter through to the generated img tag.Joey Hess2009-07-11
|
* img plugin: do not emit a redundant double-quote before alt attributeSimon McVittie2009-06-16
|
* Avoid %links accumulating duplicates. (For TOVA)Joey Hess2009-05-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is sorta an optimisation, and sorta a bug fix. In one test case I have available, it can speed a page build up from 3 minutes to 3 seconds. The root of the problem is that $links{$page} contains arrays of links, rather than hashes of links. And when a link is found, it is just pushed onto the array, without checking for dups. Now, the array is emptied before scanning a page, so there should not be a lot of opportunity for lots of duplicate links to pile up in it. But, in some cases, they can, and if there are hundreds of duplicate links in the array, then scanning it for matching links, as match_link and some other code does, becomes much more expensive than it needs to be. Perhaps the real right fix would be to change the data structure to a hash. But, the list of links is never accessed like that, you always want to iterate through it. I also looked at deduping the list in saveindex, but that does a lot of unnecessary work, and doesn't completly solve the problem. So, finally, I decided to add an add_link function that handles deduping, and make ikiwiki-transition remove the old dup links.
* img: only provide alt text if it was specifiedGabriel McManus2009-01-21
| | | | | | if suitable alternate text is unknown, then it should not be given. empty alt text is suitable mainly for purely decorative images. (cherry picked from commit 3cd7f67f0cf894f4fd5ba16f68e82e4f7bdbfdc5)
* finalise version 3.00 of the plugin apiJoey Hess2008-12-23
|
* Coding style change: Remove explcit vim folding markers.Joey Hess2008-12-17
|
* img: Support sizes like 200x. Closes: #475149Joey Hess2008-09-09
|
* add plugin safe/rebuild info (part 1 of 2)Joey Hess2008-08-03
| | | | too many plugins.. brain exploding..
* don't show an error if the image is missing, instead, a broken linkJoey Hess2008-07-21
|
* avoid internal error message when img uses just-deleted pageJoey Hess2008-07-21
| | | | | | | | | | | I think this used to be a fatal error, not just inline error, so I don't know why it was never noticed, but if a page that an img directive mentions gets deleted, bestlink() returns a file that no longer exists, and srcfile() throws an error. Note that bestlink's behavior of returning a deleted file could be considered buggy. But, if it's changed to not do that, the page with the img on it is not updated at all when the file is removed.