So in a project I’m working on I need to use a normal form to insert a post into the database. My client wanted the form to also add an image to the post. Furthermore, the image must be inserted using normal WordPress methods. The code below is the minimum required to insert an image into the database and attach it to a specific post.
// $id is the id of the post being inserted
// $name is actually the name of the form input that uploaded the file so WP can access it using $_FILE[$name]
If you are inserting a new post, it makes sense to have the line $id = wp_insert_post($post_data); before this.
The image resize software demonstrated in the video is meant to enable a web browser to resize images without removing context or quality. It does this by removing areas of the image deemed less important by using algorithms that detect curved lines instead of normal straight lines. I’m very impressed with the software and I think it will profoundly effect web design and even amateur photography: who hasn’t wanted to erase an ex from pictures?
Now there was a response video to this that complained about how it will modify the context of photographs and art work, but I don’t think this is really an issue. Some browsers already scale large images if you try to view just the image and users are already used to clicking on thumbnails: both of which allow you to see their original size just by clicking on them. If these same techniques are applied to the images resized through this software, users will learn to click the images to see a full version. The only difference is the thumbnails and rescaled images will still show the elements of the picture: rather than just seeing a few blotches of color in a thumbnail, you will see the important details scaled down, but with the less important details removed.