I also posted this as an issue on PDF Embed’s github. No matter what size image settings chosen (thumbnail, square thumbnail, fullsize), PDF Embed embeds the whole .pdf file on Exhibit Builder page instead of letting the block use a thumbnail as selected.
In the meantime, is there a way to override PDF Embed from hijacking the file images within Exhibit Builder? I’m currently trying to modify File Text layout (in Foundation theme) with no luck, just errors. I can’t seem to get
$forceImage to work. I thought that function might stop PDF Embed from transforming the attachments as an embedded PDF, but I don’t know the language. Any insight?
This isn’t exactly a PDF Embed issue, more of an Exhibit Builder one: the File with Text block will just always try to embed if the file is embeddable (so for example, a video would embed also).
$forceImage should work for what you’re trying to do, though. How are you trying to use it?
Hey, thanks for the reply!
Well, that’s my problem. I don’t understand the syntax to use a boolean argument. I tried to replace the
$attachments as $attachment in various ways on layout.php, looked at helpers functions where it mentions
if ($forceImage) and still didn’t understand how to actually put it to use? Like I don’t know if I echo $forceImage or if I replace $attachment. I have no idea what I’m doing.
The manual doesn’t explain for a layperson how to write something with that variable, just what it passes through(?), so that’s part of my problem.
Sorry for double-post, but I just checked using a shortcode in a Text block as a stop-gap and it has the same problem, even with thumbnail size specified. E.g.,
[file id=37 size=thumbnail]. That seems a little aggressive for PDF Embed. If someone doesn’t have PHP knowledge and they try to use a shortcode on an exhibit it still comes back with the full embed.
EDIT: Well, tried to manually add a thumbnail with HTML but the Text block strips it out completely. I have no idea why it would disallow custom HTML there. So it’s basically mandatory I solve this to be able to use Exhibits at all with single images.
What did you try with the code and $forceImage? It’s an argument to exhibitAttachment, meaning you need to pass a value to it:
$this->exhibitAttachment($attachment, array('imageSize' => $size), array(), true);
file shortcode works just like the file Exhibit blocks: it tries to render the file in the “best” way, which means embedding if PDF Embed is installed. Again, the same is true for audio and videos.
As for manual HTML, it’s handled in Exhibit Builder much as it is elsewhere: it’s controlled by your HTML filtering settings under Settings -> Security. You can add
img tags to the allowed list (you’d also have to add
img.src to the list of attributes, at least), or disable filtering completely.
I definitely wasn’t replacing this line correctly, but it works now! I will have to find the same line for the Gallery block showcase, as it also turns into a PDF embed. Thanks!
This topic was automatically closed after 250 days. New replies are no longer allowed.