Sign in to follow this  
Followers 0
Simon Brown

Upload to... v2.6

78 posts in this topic

Uploading images to the internet is common nowadays, and yet it still takes effort to save the image to one's hard-disk, go to a photo hosting service, find the image in your badly organised file-system and copy the link. This plugin allows you to just flatten the image, select Effects -> Tools -> Upload to... and follow the on-screen instructions.

LiubS.png

rXoxt.png

Hidden Content: How to add Photobucket support.

Download PhotobucketNet, rename it to PhotobucketNet.dll and place it in the same folder (Paint.NETEffects) as UploadTo.

0

Share this post


Link to post
Share on other sites

YES! This is like a built in QuickShot. Very awesome Simon, thank you.

EDIT: Got an "upload failed" message. I think it's because the image size was larger than 1.5mb. Would there be a way of implementing an image compressor type thing? Not necessarily a resizer... but as in Quick Shot, where it somehow magically gets the image onto the web without resizing or too much quality loss.

0

Share this post


Link to post
Share on other sites

I guess I could do that automatically if I knew ImageShack's maximum size. I guess I could have it use JPEG automatically, but that wouldn't support transparency. Allowing the user to configure the upload would, of course, mean another click (at the least) for the user.

0

Share this post


Link to post
Share on other sites

Still better than necessarily opening up a whole new web window. I wouldn't mind having to go through a couple of buttons.

Do you know what Quick Shot uses to compress the PNGs? Maybe that could be implemented.

0

Share this post


Link to post
Share on other sites

I have no idea. What would you say to it just automatically resizing to the highest size availible in QuickShot?

0

Share this post


Link to post
Share on other sites

Ugh... I dunno about straight resizing. Could there be a combination of quality-loss and resizing? So there is less resizing involved?

I'll check out the update when I can.

0

Share this post


Link to post
Share on other sites

would it be possible to do the same things for other sites like photobucket or deviantart? this plugin looks awesome! nice job.

0

Share this post


Link to post
Share on other sites

I may do it with Photobucket, but I havn't heared of a dA API. If you can find an API for a popular photo upload service I will consider adding support.

0

Share this post


Link to post
Share on other sites

I have heared of the Photobucket API, which is why I only said I couldn't find one for dA. :wink:

0

Share this post


Link to post
Share on other sites

what a shame........................ :shock:

it would be great, but anyway hope someone else continue.

thanks

0

Share this post


Link to post
Share on other sites
Just one PhotoBucket - not the entire plugin.

yes of course :lol: , i think photobucket is really famouse and has so many people even in his forum, i noticed many useing it, imageshake is still good but i started my pictures in photobucket because of the storage and bandwidth.

so still :mrgreen: hope photobucket appear, and

HOPE 2 SEE OTHER IDEAS LIKE THIS APPEAR :twisted:

those are other things that for sure will make Paint.NET really stand out :P

0

Share this post


Link to post
Share on other sites

Is anyone interested in me posting imageshack.cs and details of the methods provided to easily perform a POST to allow people to add new sites to be included in future versions?

0

Share this post


Link to post
Share on other sites

That would be most helpful, as I've been considering writing a plugin to automatically FTP an image to my web host and would like to use yours as a base.

0

Share this post


Link to post
Share on other sites
That would be most helpful, as I've been considering writing a plugin to automatically FTP an image to my web host and would like to use yours as a base.

hope you add it tp photobucket. 8)

0

Share this post


Link to post
Share on other sites

Here is ImageShack.cs:

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.IO;
using System.Collections.Specialized;
using System.Net;
using System.Xml;
using System.Windows.Forms;

namespace ImageShackUpload.UploadSites
{
   public class ImageShack : SiteInterface
   {
       String SiteInterface.Name()
       {
           return "ImageShack";
       }

       String SiteInterface.TokenUrl()
       {
           return "http://profile.imageshack.us/registration/";
       }

       Boolean SiteInterface.AllowsGuests()
       {
           return true;
       }

       String SiteInterface.UploadImage(Image image, String token)
       {
           NameValueCollection queryString = new NameValueCollection();
           queryString["xml"] = "yes";
           if (!String.IsNullOrEmpty(token)) queryString["cookie"] = token;

           String tmpHome = Path.Combine(Path.GetTempPath(), "szhxndxksmmws.png");
           image.Save(tmpHome);
           String returnMessage = PostTools.UploadFileEx(
                   tmpHome, "http://www.imageshack.us/index.php",
                   "fileupload", "image/png", queryString, new CookieContainer());
           File.Delete(tmpHome);

           return returnMessage;
       }

       UploadedImage SiteInterface.ParseResponse(String response)
       {
           XmlDocument responseDoc = new XmlDocument();
           responseDoc.LoadXml(response);

           XmlNode linkList = ((XmlDocument)responseDoc).GetElementsByTagName("links")[0];

           UploadedImage uploadedImage = new UploadedImage();

           uploadedImage.Hyperlink = Helpers.FindChild(linkList, "ad_link").InnerText;
           uploadedImage.DirectLink = Helpers.FindChild(linkList, "image_link").InnerText;

           return uploadedImage;
       }
   }
}

To more easily do a POST use the following method:

PostTools.DoPost(String url, String args);

The token variable is what the user typed in as their registration code. The "token url" is the web address the user is sent to if they click the link to tell them how to construct this code. You'll need to find a way to compact all details into this one box, I didn't allow UI customisation to avoid complicating things. If you don't have a website to host the instructions either use TinyPaste or simply post them in this thread.

Post any sites you add support for and I will consider adding them. (and, of course, give you credit) If your site requires an API key leave it out and I will register and add my key in.

0

Share this post


Link to post
Share on other sites

Note that DoPost() returns a String.

Oh, and to do an md5 (for hashes) use the following method:

String md5(String text);

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0