How to get image URL from media_sideload_image?

Try the fourth input parameter (available in 4.2+): @param string $return Optional. Accepts ‘html’ (image tag html) or “https://wordpress.stackexchange.com/questions/212512/src” (URL). Default ‘html’. So change your code snippet to: $new_image_url = media_sideload_image($new_url, $post_ID, $title, $src=”https://wordpress.stackexchange.com/questions/212512/src” ); to get the src instead of the default html. Note that the output might also be an WP_Error object for … Read more

Can wp_get_image_editor convert to icon?

No. At least I’ve never saw it. Although I believe that you can tailor some solution. Since WordPress 3.5 in WP_Image_Editor is added support for Imagick by default (which is a wrapper to the ImageMagick library). You can check class-wp-image-editor-imagick.php to see how it’s integrated and if you have ImageMagick installed on your server, probably … Read more

Controlling image output size ACF repeater [closed]

I always set ACF to return “ID” (not object or URL) – that way ACF doesn’t get involved (& potentionally populate an object with vast amounts of data I don’t need) and I can do as I wish: <?php $landing_slideshows = get_field( ‘landing_slideshow’ ); // var_dump( $landing_slideshows ); foreach( $landing_slideshows as $landing_slideshow ) : ?> … Read more

How to indent pictures on WordPress blog? [closed]

The issue that on those images you’re using aligncenter in the content and on your blog you have alignnone. Center aligning does just that, centers your content in the container putting margins on either side. You need to go to your editor, click each image, then click edit: This will bring you to a media … Read more

Image Crop Not Working

I figured it out. I had to pass the image in as an ID rather than a URL. <?php $image_id = get_field(‘content_image_1’); $image_size=”home-left-column-block”; $image_array = wp_get_attachment_image_src($image_id, $image_size); $image_url = $image_array[0]; ?> <img src=”https://wordpress.stackexchange.com/questions/220603/<?php echo $image_url; ?>” alt=”<?php echo the_field(‘content_block_title_1’); ?>” height=”420″ width=”630″>

add_image_size not working

For this to work, you must have added the thumbnail support. You can use the following code in functions.php to add the support add_theme_support( ‘post-thumbnails’ ); add_image_size(‘poster-full’, 450, 9999, false); and to display the image: if ( has_post_thumbnail() ) { the_post_thumbnail(“poster-full”); }else{ echo “No thumbnail”; }

Weird encoded error when using wp_generate_attachment_metadata()

I tracked the error down through several functions to GD’s imagejpeg() function. So I checked the error log and found this: HTTP wrapper does not support writeable connections A quick search found that this resulted from using a full URL instead of a server filepath. So I changed the value of $filepath to use $wp_upload_dir[‘path’] … Read more