big trouble with javascript

Relative URLs work nicely in wordpress, which is the reason for your failures. In general never use relative URLs for resources as they will most likely fail when a site is using “pretty permalinks”. Best thing for what you are doing is to “group” the graphical resources and styling in a CSS (in which resources … Read more

Force square image crop during upload?

Your assumption that all images are uploaded from a browser is false. Currently images can be uploaded via the XML-RPC protocol and once the REST API will be merged it will also be used to upload images. Images can also be imported from other sites. The point is that you should not assume that images … Read more

How to test if there are no more previous or next image on attachment page?

You need to use the adjacent image link filters, defined in the source of adjacent_image_link() function. Example: add_filter( “next_image_link”, “cyb_next_image_link”, 10, 4 ); function cyb_next_image_link( $output, $attachment_id, $size, $text ) { if( $output == ” ) { return ‘<div class=”next-image”><span>NEXT</span> <i class=”fa fa-angle-right”></i></div>’; } return $output; } add_filter( “previous_image_link”, “cyb_previous_image_link”, 10, 4 ); function cyb_previous_image_link( … Read more

Large image not showing dimensions in Media Library

I see this happen when WP runs out of memory or time while processing large images. The image resizing, including setting the attachment custom fields for the dimensions, doesn’t complete. It can be the image dimensions (uncompressed file size really) rather than jpeg file size that are the problem, as the image is decompressed into … Read more

Can’t get text to wrap around image

WordPress provides a few generated classes just for this issue. What you probably want is to float the image left in your example. The CSS rules listed in the Generated Classes section of this Codex page are what you are after. https://codex.wordpress.org/CSS#WordPress_Generated_Classes For the sake of future-proofing or a URL change, here is that content: … Read more

Save Image in wp_options-Table

After some time I found out how to solve my Problem. In short, I have to use Javascript to open the WP-Media Uploader. And in my options I only save the attachment ID. Here is my code: HTML / PHP: <?php $options = get_option( ‘mysettings’ ); $image_id = esc_attr__( $options[‘image_id’]); ?> <div id=”logo”> <?php $hasImage … Read more

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

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