Articles of images

How to upload imagick resource to media in wordpress

$filePath = wp_get_attachment_url( $id ); $tempfilename = explode(“/”, $filePath); $temppdffile = end($tempfilename); $cuurentPath = plugin_dir_path( __FILE__ ).$temppdffile; $im = new Imagick(); $im->setResolution(300, 300); $im->readImage( $cuurentPath.'[0]’); $im->setImageFormat(‘jpg’); I have above code.. i have successsfully generated image.. $im But i have to save image to.. media in wordpress as a featured image ? Any idea.. tried every […]

Get Meta from Custom Field of Image URL

I have a custom field that is an Image and the return value of the field is Image URL. I have custom page templates where I render these image fields. Is there a way to get the meta info for the image through the image url. I do not want to change the return value […]

Consolidating two websites into one, but migrated images not appearing in Image Library

I am consolidating two websites (which are on the same server) into one. I copied the images from one website’s directory to the other using rsync. rsync -av /srv/www/site1/wp-content/uploads/ /srv/www/site2/wp-content/uploads/ The images appear in the target directory and file permissions and ownerships are fine. But the images are not appearing in the Media Library and […]

how to add an image to the footer?

so I am looking through some code that I did not write. It has this piece of code here: <nav id=”footer-nav” class=”span8 last”> <a href=”#”><button class=”footerButton”>Menu</button></a> <!–div class=”menu-button”>Menu</div–> <?php wp_nav_menu( array(‘menu’ => ‘Footer Menu’) ); ?> </nav><!– id=”footer-nav” –> What I am interpreting from this piece of code is that there is a footer menu […]

Featured image (responsive) above content is too small after update to WordPress 4.4

In my theme, I placed a featured image of a page above both the content and sidebar columns, spanning both columns, using <?php the_post_thumbnail(‘large’); ?> where “large” size is defined as 980px. Their width is responsive thanks to css. This worked fine until the WordPress 4.4 upgrade. After the update, which includes the core responsive […]

How Do I Delete All The Images from WordPress

I want to delete all the images. By all I means Images from Media Library as well as the from posts. I have 4000 images in wordpress upload directory and each image is attached to a post. By ‘detach’ and deleting a image permanently form Media Manger is not removing the image from the Post. […]

Why is WordPress serving the 1024px version of my image and not the original on a 1920×1080 screen?

I have uploaded an image that is 2100px wide into a post, and inserted that image in the post body. I’m building a custom theme based on WordPress’ Twenty Sixteen. The HTML looks OK: <img class=”alignnone wp-image-2669 size-full” src=”http://…/wp-content/uploads/2017/07/GrillSommer1.jpg” alt=”” width=”2100″ height=”904″ /> in the frontend, WordPress does what I assume is its “responsive image” […]

Add attribute to caption shortcode from custom attachment field

I want to add class to caption shortcode, pulled from custom attachment field. I add the field via: function add_img_class( $form_fields, $post ) { $form_fields[‘img_class_field’] = array( ‘label’ => __( ‘Image class’, ‘text-domain’ ), ‘input’ => ‘text’, ‘value’ => get_post_meta( $post->ID, ‘img_class_field’, true ) ); return $form_fields; } add_filter( ‘attachment_fields_to_edit’, ‘add_img_class’, 10, 2 ); function […]

change the $content_width

I am creating a child theme based on 2016 I want to set new upload media images add_action( ‘after_setup_theme’, ‘azm_add_image_size’ ); function azm_add_image_size() { add_image_size( ‘helen’, 936 ); add_image_size( ‘brian’, 227 ); } add_filter( ‘image_size_names_choose’, ‘my_custom_sizes’ ); function my_custom_sizes( $sizes ) { return array_merge( $sizes, array( ‘helen’ => __( ‘helen’ ), ‘brian’ =>__( ‘brian’) ) […]

How to insert multiple images into a single post within a CPT

I have created a Custom Post Type to publish multiple images together. —>>> title <<<— —>>> image default – thumbnail <<<— —>>> cotent <<<— —>>>images<<<— —>>>images<<<— ….. The first three sections (title, image default and content) is the basics. Is ready. I thought about using custom metabox and add each image URL. However, add url […]