Prevent large image uploads

You have a few different solutions available here: Automatically scaling down If you just do not want to store huge amounts of image data on your webspace, I’d recommend the Plugin Imsanity. This automatically scales down the uploaded images, even if they are too big. Forbid large uploads In this case the user has more … Read more

Remove P tags from images

1) Filter wpautop() with ACF: function filter_ptags_on_images($content) { $content = preg_replace(‘/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU’, ‘\1\2\3’, $content); return preg_replace(‘/<p>\s*(<iframe .*>*.<\/iframe>)\s*<\/p>/iU’, ‘\1’, $content); } add_filter(‘acf_the_content’, ‘filter_ptags_on_images’); add_filter(‘the_content’, ‘filter_ptags_on_images’); If you have both of those try checking with a later priority on the add_filter. It’s possible the theme or plugin or acf is overriding you…. add_filter(‘acf_the_content’, ‘filter_ptags_on_images’, 9999); … Read more

Img Src File path issue

No your file path setup is correct, you need to provide the absolute path in you img src for images to load on other pages as relative path would change to, http://yourwebsite.com/page/wp-content/themes/blankslate/images/morebutton.png and instead it should be http://yourwebsite.com/wp-content/themes/blankslate/images/morebutton.png So you should define a constant in your function.php for path to image directory, and then use … Read more

Image Scaling using get_the_post_thumbnail issue in WordPress

ALWAYS REGENERATE SOURCE SET ON IMAGE EDIT (New material, especially the custom function, follows conversation in comment thread.) The following function automatically regenerates a full source set after an image edit action. /** * ALWAYS REGENERATE FULL SOURCE SET AFTER EDITING IMAGE * answering StackExchange WordPress Development Question * see: https://wordpress.stackexchange.com/questions/288581/image-scaling-using-get-the-post-thumbnail-issue-in-wordpress/ * exploits code already … Read more

wp_get_attachment_image_src problem

Try using the Regenerate Thumbnails plugin, that will run through all your media and regenerate thumbnails according to the registered image sizes. Also note that that you’re getting the hight parameter as 226 because during add_image_size your third parameter said to not crop the image. Change that to true if you need cropping.

Navigate with keyboard in Gallery shortcode

The Underscores (_s) starter theme comes with a keyboard navigation script for this. I haven’t tested this myself though. But the JS file looks like this: jQuery( document ).ready( function( $ ) { $( document ).keydown( function( e ) { var url = false; if ( e.which == 37 ) { // Left arrow key … Read more

Auto-modifying original [full size] images

Yes, there is. Found here: http://www.wprecipes.com/how-to-automatically-use-resized-image-instead-of-originals It will replace the original picture with the large size, defined in Media Settings (/wp-admin/options-media.php). Here’s the code: add_filter(‘wp_generate_attachment_metadata’,’replace_uploaded_image’); function replace_uploaded_image($image_data) { // if there is no large image : return if ( !isset($image_data[‘sizes’][‘large’]) ) return $image_data; // paths to the uploaded image and the large image $upload_dir = … Read more

WP 3.5 and Galleries – how to count images?

This works: $images = get_children( array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘numberposts’ => 999 )); if ( $images ) { $total_images = count( $images ); } The variable $total_images will hold the count of images in your gallery.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)