0
votes
1answer
19 views

Add rel to all images in a post

I want to add a rel to all images in a post. I am trying following filter but it will wrap only the images which are in the gallery. It does not wrap the images which are added individually without ...
2
votes
1answer
50 views

Filter Media Library by author or post_parent

I am trying to filter the Media Library so only media items that are uploaded by the current user OR children of the post being edited are visible. I've had no problem doing it if the conditions are ...
0
votes
0answers
11 views

When adding media, can I filter the HTML generated from “Insert From URL” before it hits the editor?

function test_function( $html ) { return $html . 'TEST!'; } add_filter( 'post_thumbnail_html', 'test_function', 21 ); add_filter( 'image_send_to_editor', 'test_function', 21 ); add_filter( ...
0
votes
1answer
26 views

Surround uploaded image link with div

When you upload image you have smth like this <a href="http://vitya/wp-content/uploads/2014/06/8.jpg"> <img class="alignnone size-Small x Big wp-image-65" ...
0
votes
0answers
10 views

How to change the structure of an image attachment in a post?

I'm trying to solve a problem with the attached images in a post. Somehow the structure is not working right on a theme i'm using. Instead of showing a div with the class "wp_attachment" is just a h6 ...
0
votes
0answers
17 views

How do I adjust/remove img widths when embedding posts in a narrower external site?

I have a blog on a PHP site i.e. http://mywebsite.com/blog/ and want to embed complete posts in a page on http://mywebsite.com/ include('blog/wp-load.php'); $post=get_post($postid); ...
0
votes
0answers
38 views

Alter any uploaded image BEFORE saving (apply blur or similar even on the original version)

I am looking for a way to add a blur effect or similiar to any saved image. I do not want to have the unaltered originals on my server. The reason is that I am sued for using a copyrighted image ...
0
votes
2answers
290 views

Permanently remove first image from posts

I have around 2,500+ posts on my site where I've inserted images using the traditional method into the post content itself. In upgrading to a different theme, the single post page now displays the ...
0
votes
0answers
19 views

Modify images when inserted in to WYSWYG Editor

When an image get added it currently adds <a href="www.domain.com/image.jpg"><img src="www.domain.com/image.jpg" /></a> I am aware that user can directly add the link. However the ...
0
votes
0answers
61 views

Removing image dimensions from `the_content`

I'm looking to remove image dimensions from the_post_thumbnail, as well as the_content. I've found the following code, but there's a slight issue: add_filter( 'post_thumbnail_html', ...
1
vote
0answers
56 views

Add custom text in the media library image meta area

I want to add some custom text in this area in the media library: Is there a filter I could hook into or how can I add content there? If not, how do we do this using Javascript? I want the text to ...
0
votes
0answers
159 views

Rename uploads filenames to POST-ID on upload

I would like to change the way Wordpress rename uploaded files on upload. As I upload an image whose filename is "see-sunset.jpg", Wordpress will set up scaled versions and rename filenames to ...
1
vote
1answer
442 views

Rename image uploads replacing “width” and “height” in filename with “medium”, “large”, “small”

Good morning, I am trying to change name format that Wordpress uses to rename uploaded files. As I upload an image whose filename is "desert-landscape.jpg", Wordpress will set up scaled versions and ...
0
votes
1answer
314 views

hook into completed image upload filter

I'm trying to run a little function to determine the luminance of an image and store that in the postmeta for that image.. I have the function working, but id like it to fire when an image has ...
0
votes
1answer
771 views

How can I change the <img src> to <data-original> for lazyload wp smilies

I tried to improve my WordPress performance, and already put the content <img> with jQuery LazyLoad. Now, I got some problem in changing the smilies src, already set the theme smilies add ...
1
vote
0answers
116 views

Conditional Image Sizes for Use via Theme Customizer Upload Only

I'm looking for a way to add image sizes that are only generated by uploads happening in the Theme Customizer, any suggestions or direction on how this could be done? I've already worked with the ...
2
votes
1answer
420 views

Hide custom image sizes from media library

I want to hide a few custom image sizes from the media uploader: The following code (posted here) works only for the default image sizes: function remove_image_sizes($sizes) { ...
0
votes
1answer
266 views

How can I use wp_save_image_editor_file filter?

I would like to use wp_save_image_editor_file filter, but there is no documentation on the internet. Also, it seems that no matter how many arguments I pass to the handler, all are null.
2
votes
1answer
2k views

Rename image uploads with width in filename

I am attempting to change the name format that Wordpress uses to rename uploaded files. For example, when I upload an image with filename "cat-picture.jpg" Wordpress will create scaled versions and ...
0
votes
2answers
298 views

Can I the caption shortcode to set caption to a data attribute, and with the image's alignment intact?

I want to output an image caption in this kind of format: <img class="alignleft size-medium wp-image-316" alt="Image Title" data-caption="Here lies the image caption" ...
3
votes
1answer
1k views

Change html structure of all img tags in Wordpress

I have a Wordpress blog and am trying to implement the foresight.js image script. In short, I need to target all post images, swap out the src, width, & height attributes with data-src, ...
1
vote
1answer
199 views

Alter image output in content

I'm trying to implement the JAIL javascript into my WordPress install. The javascript requires me to add a data-attribute and change the output html of images. I have been looking through the codex ...
5
votes
2answers
1k views

Set JPEG compression for specific custom image sizes

I use various custom image sizes (by add_image_size) and I have set my JPEG compression to 30% with this filter: function jpeg_quality_callback($arg) { return (int)30; } add_filter('jpeg_quality', ...
1
vote
1answer
528 views

How can I remove the image attachment ALT field?

I've been using the technique described in this post to remove the caption and description fields in the uploads modal window, thus eliminating unused clutter for users. Since the title field is ...
2
votes
3answers
639 views

Filter to modify post_title after image upload?

When I upload images, Wordpress 3.4.2 sets the Title to the base of the filename, such as "DSCN1234" or "IMG_1234". I'd like the Title to be left blank. The code that sets the Title during the upload ...
4
votes
2answers
509 views

Removing default image size list in Media Box

I trying to remove unused image size (Thumbnail, Medium, Large) in MediaBox Any function can i use in functions.php ? or some trick ? PS : I know i can use jQuery trick but any better function to ...
0
votes
1answer
216 views

Is there any action/filter hook to use when an image gets edited in the editor?

I can't find a specific hook. If I already have added an image to an article via editor and then I edit it, I'd like to intercept the code just before it is sent again to the editor. I already use ...
6
votes
1answer
656 views

Changing JPEG compression depending on image size

Short. I want ''large' images compressed by 90%, and 'medium' to be by 60%. Has many af you know, sometimes larger images suffer from high compression, but other small images don't. This function ...
1
vote
1answer
698 views

add data-attribute to all images inside the_content()

I wonder if it's possible to add a filter to all images inside the_content() to create the following image pattern for all images … <img class="digest" src="smallest-file.jpg" ...
0
votes
2answers
627 views

Filter for post_thumbnail: link to small src and add data-attribute

I wonder how I can link manually to the smallest filesize for the_post_thumbnail() within its filter function … add_filter( 'post_thumbnail_html', 'post_thumbnail_html', 10, 3 ); function ...
3
votes
1answer
420 views

Preview Image Path in Admin Section

So I have run into a little glitch. i have a custom path for uploads and it works. the files get saved to the right place, etc. The problem I have is the 'widget box' in the admin section. immediately ...
0
votes
2answers
280 views

How can I add inline CSS for each image?

Is there a filter or hook that I can use for uploaded media? I need to use it for custom CSS properties based on the media's description. It will be like: <img src="image_url" style="width: ...
1
vote
1answer
79 views

Publish/Update post is changing image links from file url to post url

I've written a filter to wrap images included in posts with figure tags and their captions with figcaption tags. I turned off the visual editor so that it doesn't strip out all the html from the ...
0
votes
1answer
174 views

get_image_tag filter not working

I'm trying to get the custom field data off an attachment and display it following the image tag in a page/post using the get_image_tag filter. I'm using the same function to get the same data and ...
6
votes
1answer
6k views

Removing Image and Caption Dimension Attributes

This question is an offshoot from the this discussion on removing dimension attributes from images. The solution code provided on that thread works very well except that it has the unfortunate side ...
1
vote
2answers
2k views

Need help building a filter to edit the output of “image_send_to_editor”

What I'm trying to do is edit the output of image_send_to_editor so that i can make the anchor that wraps around the image have a specific class & rel. I plan to basically make each image that ...
4
votes
2answers
5k views

Default Image Link Removal

Just wondering if there is a way to remove WordPress's default function of adding a tag around an inserted image. I assume its a "remove_filter" function like you can do for WPAutoP, but all my ...
0
votes
3answers
2k views

What's the proper way to use the get_image_tag filter?

I'm attempting to remove the title attribute for post thumbnails (on certain posts), and I assume the get_image_tag filter is the way to do this. However, what I've got so far isn't working. What do I ...
0
votes
3answers
634 views

How to retrieve the postID in a “image_send_to_editor” hook function?

Here is my function: function insert_img_rel_attrib( $html, $id, $caption, $title, $align, $url ) { $postID = ??? $rel = "<a rel='shadowbox[".$postID."]'"; if ($url) {$html = ...
2
votes
2answers
536 views

Best way to programatically add “rel” attributes to page and post images

For single posts and pages, I would like to add certain rel attributes to all the images on the contained therein added with the "Add Image" functionality on the edit screen. The attribute would be ...
0
votes
2answers
295 views

How to internationalize header image?

I have in the following code in the template: <img src="<?php header_image(); ?>" /> However, I want to change this image according to the language selected (through GET parameter ...
2
votes
1answer
386 views

There's some way to add a wrapper around posted images?

I need to add a wrapper (I'll use <figure> in my example) around images posted through the editor, with a variable depending on the size image is being posted (thumbnail, medium, large, full), ...
1
vote
2answers
9k views

how to display post content without post image?

i've implemented a jQuery gallery for displaying several images within a post. the problem is that the_content(); also displays the post image. any ideas how to filter it? thanks
1
vote
3answers
9k views

Remove title attribute from images

I'm looking for a way to remove the title attribute from images, preferably through using a hook or a filter. Most clients don't bother giving images a proper title, thus eliminating the purpose of ...
24
votes
4answers
15k views

Filter to remove image dimension attributes?

I'm working on a site based on a fluid width css template which sets a max-width on images to the width of the column containing them, and I need to remove the inline width and height dimension ...
0
votes
1answer
796 views

How to display a shortcode caption somewhere other than the_content

I want to disable shortcode captions for posts in one of my themes, and display the content elsewhere, such as in a sidebar. The images aren't uploaded to wordpress, but they're linked-to using the ...