Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gid('editForm').onsubmit = function() {
- var data = gid('result').toDataURL('image/jpeg');
- var binary = atob( data.substr( data.indexOf(',') + 1 ) );
- var i = binary.length;
- var view = new Uint8Array(i);
- while (i--) {
- view[i] = binary.charCodeAt(i);
- }
- VK.api('photos.getWallUploadServer', function(serverInfo) {
- ajax.put('upload.php?url=' + encodeURIComponent(serverInfo.response.upload_url), new Blob([view]), {
- done: function(uploadInfo) {
- eval('uploadInfo=' + uploadInfo);
- VK.api('photos.saveWallPhoto', uploadInfo, function(saveInfo) {
- VK.api('wall.post', {
- message: 'Я создал свой мем в приложении vk.com/app' + query.api_id,
- attachments: saveInfo.response[0].id + ',http://' + location.host
- }, function(result) {
- console.log(result);
- nextFrame();
- });
- });
- }
- });
- });
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment