get attachment title based on attachment id
If you have the attachment id, you can use get_the_title() $attachment_title = get_the_title($attach_id) http://codex.wordpress.org/Function_Reference/get_the_title
If you have the attachment id, you can use get_the_title() $attachment_title = get_the_title($attach_id) http://codex.wordpress.org/Function_Reference/get_the_title
Take a look at Otto’s Dynamic Image Resizer plugin This plugin changes the way WordPress creates images to make it generate the images only when they are actually used somewhere, on the fly. Images created thusly will be saved in the normal upload directories, for later fast sending by the webserver. The result is that … Read more
Yes, it’s possible and pretty easy. This is the workflow I suggest: Put somewhere a UI to insert the URL of the featured image. Probably best choice is to use ‘admin_post_thumbnail_html’ filter hook Use ‘save_post’ action hook to save the URL (after security and validation routine) in a custom post meta Use ‘post_thumbnail_html’ filter hook … Read more
You can over write the default like this: add_image_size( ‘medium’, 200, 200, true );
Deleting images using plugin: You can use this plugin, it will search your database and look if image is inserted into any post (in content, as featured image, in any custom field, anywhere…) or as background… If image is not used anywhere it will give you option to delete it. You will get list of … Read more
$image_url=”adress img”; $upload_dir = wp_upload_dir(); $image_data = file_get_contents( $image_url ); $filename = basename( $image_url ); if ( wp_mkdir_p( $upload_dir[‘path’] ) ) { $file = $upload_dir[‘path’] . “https://wordpress.stackexchange.com/” . $filename; } else { $file = $upload_dir[‘basedir’] . “https://wordpress.stackexchange.com/” . $filename; } file_put_contents( $file, $image_data ); $wp_filetype = wp_check_filetype( $filename, null ); $attachment = array( ‘post_mime_type’ => … Read more
you can write a php script, or make your own plugin of this code here, i used it in one of my projects where i had to import a large number of images. first, get the image, and store it in your upload-directory: $uploaddir = wp_upload_dir(); $uploadfile = $uploaddir[‘path’] . “https://wordpress.stackexchange.com/” . $filename; $contents= file_get_contents(‘http://mydomain.com/folder/image.jpg’); … Read more
Good news for WordPress versions 4.2+ Since version 4.2 the handy get_avatar_url() function, introduced as a feature request in ticket #21195 few years ago, now ships with the core: /** * Retrieve the avatar URL. * * @since 4.2.0 * * @param mixed $id_or_email The Gravatar to retrieve a URL for. Accepts a user_id, gravatar … Read more
There is no automatic preview. You need to create the screenshot yourself and place it in the theme/child theme folder named screenshot.png The recommended image size (currently) is 1200px wide by 900px tall, however the screenshot will only be shown as 387×290. It is over-sized to allow for high-resolution viewing on HiDPI displays. Note that … Read more
The code is still a mess, but it seems to work, even on IE 8. I plan to release it in the repository, but in the meantime you can play with my current version. To access it you click the “Edit Image” when adding or editing an image, it replaces the usual image editor (they … Read more