demur
Forum Replies Created
-
Forum: Plugins
In reply to: [Document Gallery] Wrap text round single column document galleryHi @matthewmccabe!
Not sure if I got Your question right (link to Your Document Gallery would make a big difference or at least a screenshot), but I dare assume You’re experiencing widespread hitch – by default DG plugin has enabled descriptions option and it affects the appearance of the Document Galleries in such way that each attachment would occupy dedicated row being split in to areas: one for thumbnail itself, the other for attachment’s description.
To disable that option You have to put in dg shortcode descriptions=false. I would like to draw Your attention that after disabling descriptions option the columns option would take over Document Galleries appearance; default value for columns is 4. If You still want one column You should put in dg shortcode columns=1.
If You need latter appearance with descriptions under titles – have a look at this post.Please don’t hesitate to let us know if this helped or if You run into any further issues.
Forum: Plugins
In reply to: [Document Gallery] One PDF Thumbnail Smaller Than the OthersHi David!
To fix appearance of the mentioned Document Gallery instance I would recommend using DG feature for setting custom thumbnails.
Before doing that You’ll need to prepare a proper thumbnail. If You still want to have a cover (first page of the pdf file) to be as an icon, You should convert first page of the pdf to an image (png or jpg would be ok; You should set dimensions twice as big as the desired to have some freedom while editing), crop it (get rid of the unwanted white areas) and scale it to the desired size (so the image would fit thumbnail container; this step just lets You get the most efficient ratio size/quality). If You don’t have relevant software, You can find variety of free online tools, that would be of great help.
Then You should go to the Dashboard -> Settings -> Document Gallery -> Thumbnail Management of Your WordPress. Locate there row with the needed Document Gallery element and either Drag’n’Drop the prepared before thumbnail over to the defined row, or You can click on Select File button in the defined row and select the prepared thumbnail in the emerged dialog. (identical result can be achieved by using same uploading techniques on the Edit Media page of the required attachment, which can be found through the Media Library at Dashboard -> Media).I hope this would work for You.
Please don’t hesitate to let us know if You run into any further issues.Forum: Plugins
In reply to: [Document Gallery] Unable to Add to Existing…Hi @grungyape!
I’m sorry to hear that You’ve encountered some difficulties.
Having run some tests on different environments, no glitches were found yet in the mentioned area. While I continue to look for possible problems in our code we need Your help to check if this is result of mismatch in Your WP mixture.
According to Your description, there is a great probability to see JavaScript errors in browser console. Please open browser console (generally pressing F12 should do this) and proceed to the Edit Post tool with the corresponding Document Gallery instance post (or just refresh it if You are already there), then repeat all the steps You’ve mentioned to update gallery. Let us know if there are any errors in the Console.Forum: Plugins
In reply to: [Document Gallery] Move Description under thumbnail with titleHi @pettiet!
Please have a look at the latest solution on moving descriptions under thumbnails with titles.
Please don’t hesitate to let us know if You run into any further issues.
PS: If You’ve found our answers and/or the plugin useful, please rate the efforts. Thanks!
Forum: Plugins
In reply to: [Document Gallery] Insert “View” and “Download” OptionsHi David!
For now I see two solutions. One with less code based on HTML5 features, another (as You’ve mentioned) – on HTTP header approach, with more code. BTW they can be combined 😉
1. HTML5 anchor has attribute download, which now is supported by majority of web browsers.
To have this solution working You need to add the given below code to functions.php file of Your active WordPress theme:/** Modify DG icons (pdf ones) to show "VIEW" and "DOWNLOAD" links alongside title. */ function dg_icon_template( $icon, $use_descriptions, $id ) { if ( get_post_mime_type( $id ) == 'application/pdf' ) { $file_url = wp_get_attachment_url( $id ); $doc_icon = ' <div class="document-icon">' . PHP_EOL . ' <a href="%link%" target="%target%">' . PHP_EOL . ' <img src="%img%" title="%title_attribute%" alt="%title_attribute%" %data%/>' . PHP_EOL . ' <span class="title">%title%</span>' . PHP_EOL . ' </a>' . PHP_EOL . ' <a href="' . $file_url . '" target="%target%">VIEW</a>' . PHP_EOL . ' <a href="' . $file_url . '" target="%target%" download="' . basename( $file_url ) . '">DOWNLOAD</a>' . PHP_EOL . ' </div>' . PHP_EOL . ($use_descriptions ? ' <p>%description%</p>' : ''); return $doc_icon; } return $icon; } add_filter( 'dg_icon_template', 'dg_icon_template', 10, 3 );As You’ve requested additional links only for PDFs, the condition was introduced that checks if an item is PDF file and only for such elements modifies the output.
2. To be able to produce different values of the Content-Disposition header for the same attachment we need to set and track different URLs. For this purpose I suggest utilizing REST API v 2.0 (enabled in WordPress since 4.4).
Same thing: to make use of this solution You need to add given the below code to functions.php:/** Modify DG icons (pdf ones) to show "VIEW" and "DOWNLOAD" links alongside title. */ function dg_icon_template( $icon, $use_descriptions, $id ) { if ( get_post_mime_type( $id ) == 'application/pdf' ) { $filename = basename( get_attached_file( $id ) ); $doc_icon = ' <div class="document-icon">' . PHP_EOL . ' <a href="%link%" target="%target%">' . PHP_EOL . ' <img src="%img%" title="%title_attribute%" alt="%title_attribute%" %data%/>' . PHP_EOL . ' <span class="title">%title%</span>' . PHP_EOL . ' </a>' . PHP_EOL . ' <a href="/wp-json/dg/v1/view/'.$id.'/'.$filename.'" target="%target%">VIEW</a>' . PHP_EOL . ' <a href="/wp-json/dg/v1/download/'.$id.'/'.$filename.'" target="%target%">DOWNLOAD</a>' . PHP_EOL . ' </div>' . PHP_EOL . ($use_descriptions ? ' <p>%description%</p>' : ''); return $doc_icon; } return $icon; } add_filter( 'dg_icon_template', 'dg_icon_template', 10, 3 ); add_action( 'rest_api_init', function () { register_rest_route( 'dg/v1', '/(?P<action>view|download)/(?P<id>\d+)/.+', array( 'methods' => WP_REST_Server::READABLE, 'callback' => 'dg_process_link', 'args' => array( 'id' => array( 'validate_callback' => 'is_numeric', 'required' => true, ), 'action' => array( 'required' => true, ), ), ) ); } ); /** * Processing PDF file request from Document Gallery and responding in appropriate way * * @param array $data Options for the function. * @return WP_Error if non-existing or non-pdf attachment was requested, otherwise the requested attachment would be outputted. */ function dg_process_link( $data ) { if ( in_array( $data['id'], array_keys( DG_Thumb::getThumbs() ) ) && get_post_mime_type( $data['id'] ) == 'application/pdf' ) { $file = get_attached_file( $data['id'] ); if ( file_exists( $file ) ) { header( 'Content-Type: application/pdf' ); header( 'Content-Disposition: ' . ( $data['action']=='view' ? 'inline' : 'attachment' ) . '; filename="' . basename( $file ) . '"' ); header( 'Content-Length: ' . filesize( $file ) ); readfile( $file ); exit; } } return new WP_Error( 'invalid_link', 'Invalid link :-(', array( 'status' => 404 ) ); }I hope this would work for You.
Please don’t hesitate to let us know if You run into any further issues.PS: If You’ve found our answers and/or the plugin useful, please rate the efforts. Thanks!
Forum: Plugins
In reply to: [Document Gallery] Insert “View” and “Download” OptionsHi David!
I understand Your anxiety.
Unfortunately if You want something besides “Yes that’s possible.” You have to wait for us to find some sufficient _free_ time (as this activity doesn’t feed us and we have to work) to get proper solution and test it so we would provide answer that could fit majority cases.
If You need it desperately and ready to pay some money You can write a few words to Dan through Contact form.Thank You for Your patience.
Forum: Plugins
In reply to: [Document Gallery] Use is Widget?Hi John!
Despite absence of native support for widgets in DG out of the box, there is a quick hack for now to enable it 😉
You should include given below string to Your active WordPress theme’s functions.php file:
add_filter('widget_text', 'do_shortcode');
This will allow usage of shortcodes (including dg) in widgets 🙂
Please note: use of default [dg] (without specifying id or ids property) will result in displaying respective attachments for each requested post.PS: If You’ve found our answers and/or the plugin useful, please rate the efforts. Thanks!
- This reply was modified 9 years, 5 months ago by demur.
Forum: Plugins
In reply to: [Document Gallery] Thumbnails – size and alignmentHi @0ldfart!
I’m terribly sorry it took so long for You to get a reply. Thank You for the patience.
We are delighted that You’ve found the plugin 🙂
New design of Support Threads is quite inconvenient, as a result – challenges for those who tries to find available solutions and also obstructions for those who can provide any help…1. I believe You’ve tried changing dimensions of generated thumbnails at Dashboard -> Settings -> Document Gallery -> Max Thumbnail Dimensions. That set the actual dimensions for thumbnails. To get it to work You also need to adjust width value of img containers in the Custom CSS textbox at Dashboard -> Settings -> Document Gallery:
.document-icon img { width: 300px !important; }DG is designed in such a way it tries to fit each thumbnail into square content box scaling it with fixed height/width ratio; content boxes are limited to the size of column (if number of those is set, size would be equally distributed over content area), but not exceeding value defined in the CSS.
2. As Your files are not square, but stretched and of both orientations You are getting messy result (also CSS of applied WP theme comes in play).
There are different ways to make it look decently, to name a few:
– As long as each title fits in a single line (BTW You can modify those at Dashboard -> Settings -> Document Gallery -> Thumbnail Management) You can apply this CSS:.document-gallery .document-icon { vertical-align: baseline !important; }– You are able to replace any thumbnail with desirable image (size, orientation, content, etc.) that would meet Your requirements. This is also can be done at Dashboard -> Settings -> Document Gallery -> Thumbnail Management;
– You can play with the order of the documents in the gallery, so thumbnails of alike size would share same rows.I hope You still find this reply handy.
Please don’t hesitate to let us know if You run into any further issues.Forum: Plugins
In reply to: [Document Gallery] List view or small icons?Hi @jgmediapro!
I’m sorry it took so long for You to get a reply. Thanks for Your patience.
We are pleased that You like our plugin 🙂
To display files in a list view You should adjust Your shortcode or default settings of the Document Gallery to meet these values: columns=1 descriptions=false
Then You should pasted given below CSS in the Custom CSS textbox at Dashboard -> Settings -> Document Gallery:.document-icon { text-align: left !important; } .document-icon img, .document-icon .title { display: inline-block !important; } .document-icon img { width: 50px !important; }You should replace 50 with any suitable for Your case number, this would affect icon size.
If You need to make the list unordered (bulleted), You should append to the above-mentioned CSS textbox this section:.document-icon:before { content: '\2219'; }In case You’d like to make the list ordered, append this section:
.document-gallery { counter-reset: icon-counter; } .document-icon:before { content: counter(icon-counter, decimal-leading-zero); counter-increment: icon-counter; }In case You’d like to change dimensions of generated thumbnails (if You use fancy=true) You can adjust those at Dashboard -> Settings -> Document Gallery -> Max Thumbnail Dimensions, for proper result don’t forget to modify width value for the .document-icon img in Your CSS.
Hope I got Your question properly 😉
Please don’t hesitate to let us know if You run into any further issues.PS: If You’ve found our answers and/or the plugin useful, please rate the efforts. Thanks!
Forum: Plugins
In reply to: [Document Gallery] no thumbnails for pdfsHi ralfer!
I’ve just inspected Your Document Gallery instance. Turns out that You are having a problem with Bootstrap JS script and this TypeError blocks DG JS script execution. Please have a look at Developer Tools.
As a precaution I’ve forced DG JS script and made server-side part of DG to produce thumbnails (You can see all the generated thumbnails at Dashboard -> Settings -> Document Gallery -> Thumbnail Management), so I can say that Your DG instance is active and produces valid output.Please don’t hesitate to let us know if You run into any further issues.
PS: If You’ve found our answers and/or the plugin useful, please rate the efforts. Thanks!
Forum: Plugins
In reply to: [Document Gallery] Bigger fontHi Cat!
We are glad that it worked out for You.
You are on the right track with the text-align thing.
The only thing that keeps You from getting the desired result is the cascade nature of the CSS. You are trying to have the text aligned inside the span by setting CSS rule for its parent (a), but span won’t inherit this property (text-align), even the !important one, due to having personal (specific) CSS rule defining this property (talking about default Document Gallery setup).
One of many solutions would be just to change the target of the used rule to:
.document-gallery .document-icon a spanHope this also will do the job for You.
Forum: Plugins
In reply to: [Document Gallery] Bigger fontHi Cat!
To adjust font size You have to add custom CSS to override default size (by default it’s only 10 pixels).
Given below CSS should be pasted in the Custom CSS textbox at Dashboard -> Settings -> Document Gallery:.document-gallery .document-icon a { font-size: 14px !important; line-height: normal !important; }Feel free to modify values so the result meets Your needs.
Hope this will do the job for You.Forum: Plugins
In reply to: [Document Gallery] centering galleryHi wengles!
By default Document Gallery instance spreads all over the width of the given parent block and centers (horizontally) its content along the occupied area. It seems that in Your case something has gone wrong and unfortunately there is not enough info to figure out how to fix it (problem could be in CSS of custom theme, if You use one, or any installed plugin, also it could be some typo in shortcode or anything beyond mentioned).
To better assist You we’d prefer to see what You get, so, please, if You can, give us a link to the problem page.To change font size You have to set font-size (by default it’s only 10 pixels).
Given below CSS should be pasted in the Custom CSS textbox at Dashboard -> Settings -> Document Gallery:.document-gallery .document-icon a { font-size: 14px !important; line-height: normal !important; }Feel free to adjust values so the result meets Your needs.
Hope this will do the job for You.Forum: Plugins
In reply to: [Document Gallery] Thumbnails have different widthHi dejudicibus,
We are glad that it worked out for You.
PS: If You’ve found our answers and/or the plugin useful, please rate the efforts. Thanks!
Forum: Plugins
In reply to: [Document Gallery] Thumbnails have different widthHi dejudicibus!
We are sorry for leaving Your question unsettled for so long.
We believe this CSS should solve Your problem:.document-gallery { display: table !important; table-layout: fixed; } .document-icon-row.descriptions { display: table-row !important; } .descriptions.document-icon-row .document-icon { display: table-cell !important; float: initial !important; min-width: 110px; }In case You’d like to set some spacing between .document-icon-row`s there is a way by adding:
border-collapse: separate; border-spacing: 0px 5px;to the .document-gallery block.
Please don’t hesitate to let us know if You run into any further issues.