Topic on Project:Support desk

Change Image Rendering Size when Printable=Yes

10
OOZ.MOO (talkcontribs)

I am using the syntax "File: filename.png|728px" to embed Images into my Wiki. I use 728px cause it sits better next to the text in my Wiki. I'm also using Mpdf extension to print out the whole Wiki Page into a pdf. The problem is the syntax creates an extra link of the source image with a compressed version of the Image with the resolution of width="728" height="410". When I take the output with Mpdf, the quality gets super low because of the compressed image that is created.

Question is, is there a way to bypass this Srcset link with the 728px which is created when Printable=Yes and use directly the picture with the original resolution instead?

I am super stuck with this, and I can't find any solution for it. Help is highly appreciated.


MarkAHershberger (talkcontribs)

It sounds like you want the PDF rendering to use a higher resolution than than web rendering, right?

OOZ.MOO (talkcontribs)

Hey Mark, thanks for your feedback. Yes exactly. I want to somehow keep the 728px in the online layout, but when I use the Printable=Yes, skip the srcset link which is created and instead use the src link which is the original size.

MarkAHershberger (talkcontribs)

That sounds like you need to file a task in phabricator and ping @Pastakhov, the maintainer of the extension.

OOZ.MOO (talkcontribs)

Ok I'll try to do that. But is it not possible to do something in the Skins CSS stylesheets? Cause basically what I do is I generate the outputs to PDF by sending the %pagelink&action=mpdf&useskin=MonoBook, and I made a little bit of changes to this Skin only for the PDF output, but it's not my default Skin. So I thought if that would be possible to change the image sizes only in MonoBook skin, through CSS that might be possible.

MarkAHershberger (talkcontribs)

That is a question for someone who knows more about CSS and the mpdf extension than I do. I think it should be possible, but I'm don't know enough about how mpdf operates to tell you.

OOZ.MOO (talkcontribs)

@Pastakhov seems a bit unresponsive. I already asked another question a few months ago and still haven't received any response.

But I've got another question which might help me achieve what I need and you might be able to help. I've been looking into the #If Parser syntaxes.

My idea was that maybe I can add a #if syntax to the images syntax that check: If %weblink&printable=yes then {img=imagelink.png} and else {img=imagelink.png|728px}

But I don't know if that is possible somehow? I didn't quite understand how the #if parser functions work. I would appreciate it if you give me some hints on that.


MarkAHershberger (talkcontribs)

The parser functions are not meant to work like that. You would be better off using JS and/or updating the PHP in the mpdf extension.

Pastakhov (talkcontribs)

Hi all, sorry for my bit unresponsive. Of course everything is possible, but there is no easy way to do that (increasing image resolution in PDF file). The Mpdf extension just sends printable version of wiki page to the mpdf library for rendering pdf file. Maybe some hooks allow to change resolution of files for printable version, I don't know... Maybe it would be the easiest way to resolve it

OOZ.MOO (talkcontribs)

Hey @Pastakhov sorry also for my late reply.

The question is where does Mpdf gets the images links from? cause when you define a pixel rate for your image in mediawiki, it creates a multiple image links (visible in the html version of the printable version also) from all the different sizes available for the image. So to be more clear, when you have a image with originally 1920px, and you set it to 1200px in mediawiki, you get different links in your html, with 1920 and 1200 and 720px and so on. This is a function mediawiki has for responsive images.

So the question is, where in the codes does mpdf decides to get the image link? cause if I would know that, then maybe I could change the decision, to the highest resolution available.

I've been searching for it in the dark in your source codes but had so far no luck. Would be in a world of appreciation if you could help me with it.

Reply to "Change Image Rendering Size when Printable=Yes"