aksl
Forum Replies Created
-
On a further thought, you could just strip the condition together and always append the original size to the output, because the browser will decide the image via the srcset attribute. The only thing that should be added is the watermarking of original image. This would be the code for the relevant part, with the condition being commented out:
//if (\count($mapped_sizes) === 0) { $width = \hacklib_cast_as_boolean(\array_key_exists("width", $imagedata)) ? ((int) $imagedata[\hacklib_id("width")]) : null; $height = \hacklib_cast_as_boolean(\array_key_exists("height", $imagedata)) ? ((int) $imagedata[\hacklib_id("height")]) : null; if (($width !== null) && ($height !== null)) { $url = \wp_get_attachment_url($id); // added: watermarking of the original image if (\hacklib_cast_as_boolean($watermark)) { $url = self::get_watermark_url($url, $query_args); } $url = Utils::get_protocol_relative_url($url); $mapped_sizes[] = array( "url" => $url, "width" => $width, "height" => $height, "name" => "original" ); } //}Might cause some side effects(?), not sure if the ‘sizes’ array element of the get_image() response is used in other cases.
Because there can be custom image sizes, perhaps this type of approach would work with codeneric\phmm\base\includes\Image::get_image().
After line 29:
$small_sizes_names = array("thumbnail", "medium"); $small_sizes_count = \count(\array_intersect($uncropped_sizes_names, $small_sizes_names));Replace line 78
if (\count($mapped_sizes) === 0) {with:
if (\count($mapped_sizes) === 0 || \count($mapped_sizes) <= $small_sizes_count) {Did a quick test and seemed to work. One additional thing that you might to consider is to label the “medium_large” as a “small” size, so that you will have full size when the gallery is displayed with 1-column view.
- This reply was modified 5 years, 10 months ago by aksl.
Gravity Forms form with a file upload field used for image uploads.
Sent the file on 13th. Got it?
I was able to reproduce the issue while not logged in. Disabling the firewall rule “file_upload Malicious File Upload (Patterns)” fixed the issue, so it seems to be the root cause. If it helps, the PHP version in use before 7.2 was 7.0.
Temporarily disabling all the File Upload rules did the trick earlier. I re-enabled all but the “file_upload Malicious File Upload (Patterns)”. I can’t reproduce the issue myself, so will have to wait a few days to see if any failed requests end up in error log.
Forum: Plugins
In reply to: [Reusable Text Blocks] Retrieving via slug conflicts with PolylangWorkaround for the issue (translates slug to ID without applying the wpml_object_id filter):
add_filter( 'text_blocks_show_text_block_id', 'fix_tb_wpml_bug' ); function fix_tb_wpml_bug( $id ) { if ( !is_numeric( $id ) ) { $page = get_page_by_path( $id, null, 'text-blocks' ); if ( $page ) { $id = $page->ID; } else { $id = 0; } } return $id; }Forum: Plugins
In reply to: [Contact Form 7] Add option to prevent wpautop for HTML mailsWPCF7_AUTOP does not apply, checked the source code, hence the request.
Reverting the effects of autop takes some effort (linebreaks, paragraph tags), given that one might need to use them in the mail template.
One (lenghty) way to do it would be to hook wpcf7_before_send_mail, replace any paragraphs and linebreaks (<p>, </p>,
) to something else (<actual-p>, </actual-p>, …), then hook wpcf7_mail_components to remove the effects of autop, and then convert the magical tags (<actual-p>, …) to real tags. I’d still wish that there was a filter (“wpcf_autop_html_mails”) that would control the behaviour.