The release candidate for WordPress 4.6 is now available.
We’ve made a few refinements since releasing Beta 4 a week ago. RC means we think we’re done, but with millions of users and thousands of plugins and themes, it’s possible we’ve missed something. We hope to ship WordPress 4.6 on Tuesday, August 16, but we need your help to get there.
If you haven’t tested 4.6 yet, now is the time!
Think you’ve found a bug? Please post to the Alpha/Beta support forum. If any known issues come up, you’ll be able to find them here.
To test WordPress 4.6, you can use the WordPress Beta Tester plugin or you can download the release candidate here (zip).
For more information about what’s new in version 4.6, check out the Beta 1, Beta 2, Beta 3, and Beta 4 blog posts.
Developers, please test your plugins and themes against WordPress 4.6 and update your plugin’s Tested up to version in the readme to 4.6. If you find compatibility problems please be sure to post to the support forums so we can figure those out before the final release – we never want to break things.
Be sure to read the in-depth field guide, a post with all the developer-focused changes that take place under the hood.
Do you speak a language other than English? Help us translate WordPress into more than 100 languages!
Happy testing!
Der Sommer ist da,
Zeit für ein neues Release.
Bald ist es soweit.
Package:
Summary:
Queue exceptions and throws them afterwards
Groups:
Author:
Description:
This package provides a trait that can queue exceptions and throws them afterwards...
Read more at http://www.phpclasses.org/package/9854-PHP-Queue-exceptions-and-throws-them-afterwards.html
Package:
Summary:
Content management system with security features
Groups:
Author:
Description:
This package implements a content management system with security features by default...
Read more at http://www.phpclasses.org/package/9848-PHP-Content-management-system-with-security-features.html#2016-07-26-10:55:02
Package:
Summary:
Manage a multiple user conversation system
Groups:
Author:
Description:
This package can manage multiple user conversation system...
Read more at http://www.phpclasses.org/package/9814-PHP-Manage-a-multiple-user-conversation-system.html#2016-07-26-10:36:57
In this tutorial we are going to show you how to make a JavaScript photobooth app that takes images using the camera on your phone, laptop or desktop. We will showcase a number of awesome native APIs that allowed us to make our project without any external dependencies, third-party libraries or Flash – vanilla JavaScript only!
Note that this app uses experimental technologies that are not available in desktop and mobile Safari.
The App
To the end user our app is just an oversimplified version of the camera app you can find on any smartphone. It uses a hardware camera to take pictures – that’s it. Under the hood, however, a whole lot of JavaScript magic is going on. Here is a high-level overview:
- We access the camera input and get a video stream from it using the getUserMedia API.
- Project the camera stream onto a HTML video element.
- When the user wants to take a picture, we copy the current video frame and draw it on a canvas element.
- Transform the canvas into an image dataURL which then can be shown on the screen or downloaded as a PNG.
In the article below we will only look at the more interesting parts of the code. For the full source go to the Download button near the top of this page or checkout the demo on JSfiddle.
Keep in mind that the navigator.getUserMedia
API is considered deprecated, but it still has pretty good browser support and is the only way to access the camera right now, until it’s future replacement – navigator.mediaDevices.getUserMedia gains wider browser support.
Demo on JSfiddle
Accessing The Camera
JavaScript provides a native API for accessing any camera hardware in the form of the navigator.getUserMedia method. Since it handles private data this API work only in secure HTTPS connections and always asks for user permission before proceeding.
Permission Dialog In Desktop Chrome
If the user allows to enable his camera, navigator.getUserMedia
gives us a video stream in a success callback. This stream consists of the raw broadcast data coming in from the camera and needs to be transformed into an actual usable media source with the createObjectURL
method.
navigator.getUserMedia(
// Options
{
video: true
},
// Success Callback
function(stream){
// Create an object URL for the video stream and
// set it as src of our HTLM video element.
video.src = window.URL.createObjectURL(stream);
// Play the video element to show the stream to the user.
video.play();
},
// Error Callback
function(err){
// Most common errors are PermissionDenied and DevicesNotFound.
console.error(err);
}
);
Taking a Still Photo
Once we have the video stream going, we can take snapshots from the camera input. This is done with a nifty trick that utilizes the mighty <canvas>
element to grab a frame from the running video stream and save it in an <img>
element.
function takeSnapshot(){
var hidden_canvas = document.querySelector('canvas'),
video = document.querySelector('video.camera_stream'),
image = document.querySelector('img.photo'),
// Get the exact size of the video element.
width = video.videoWidth,
height = video.videoHeight,
// Context object for working with the canvas.
context = hidden_canvas.getContext('2d');
// Set the canvas to the same dimensions as the video.
hidden_canvas.width = width;
hidden_canvas.height = height;
// Draw a copy of the current frame from the video on the canvas.
context.drawImage(video, 0, 0, width, height);
// Get an image dataURL from the canvas.
var imageDataURL = hidden_canvas.toDataURL('image/png');
// Set the dataURL as source of an image element, showing the captured photo.
image.setAttribute('src', imageDataURL);
}
The canvas element itself doesn’t even need to be visible in the DOM. We are only using its JavaScript API as a way to capture a still moment from the video.
Downloading The Photo
Of course, we not only want to take glorious selfies but we also want be able to save them for future generations to see. The easiest way to do this is with the download attribute for <a>
elements. In the HTML the button looks like this:
<a id="dl-btn" href="#" download="glorious_selfie.png">Save Photo</a>
The download
attribute transforms our anchor from a hyperlink into a download button. Its value represents the default name of the downloadable file, the actual file to download is stored in the href
attribute, which as you can see is empty for now. To load our newly taken photo here, we can use the image dataURL from the previous section:
function takeSnapshot(){
//...
// Get an image dataURL from the canvas.
var imageDataURL = hidden_canvas.toDataURL('image/png');
// Set the href attribute of the download button.
document.querySelector('#dl-btn').href = imageDataURL;
}
Now when somebody clicks on that button they will be prompted to download a file named glorious_selfie.png, containing the photo they took. With this our little experiment is complete!
Conclusion
We hope that you’ve learned a lot from this tutorial and that you now feel inspired to build some kick-ass photo apps. As always, feel free to ask questions or share ideas in the comment section below!