davidgtonge / Very-Simple-Post-Images

Simple image management metabox for WordPress
12 stars 2 forks source link

Switch image uploader to native Wordpress Gallery uploader #1

Open mrdavidlaing opened 13 years ago

mrdavidlaing commented 13 years ago

Currently we upload images using Uploadify.

We'd like to switch to using the native wordpress http://swfupload.org/

davidgtonge commented 13 years ago

I've started working on the change - in new branch "dev". Currently not working, I've looked at the original wordpress code in the following files: wp-admin\includes\media.php wp-includes\js\swfupload\handlers.dev.js wp-admin\async-upload.php wp-admin\media.php wp-admin\media-upload.php

Wordpress sends the users cookies as post parameters along with the file upload to get around the issue of flash not sending cookies.

It seems that for SWFUpload, a lot of custom javascript has to be written to handle all the events. I'm starting to think that we should use uploadify but with the async-upload.php upload handler.

What do you think?

ryanholder commented 13 years ago

If this was a plugin to be written just for a client project, then the solution would make sense. But after the presentation David did and some of the positive response received from the community I feel this would be a mistake.

I would work with SWFUpload to make sure you are working with currently used components. At some point the SWFUpload will be loaded and cached, why add another script to the mix? Also die hard WordPress community members will not appreciate the non standard component.

Just my 5 cents worth...

On another note what do you think has to be written to handle the events ?

davidgtonge commented 13 years ago

Hi Ryan,

Sure I understand. The handlers that Wordpress uses are in the handlers js file i referenced in my earlier comment. I had a go at using the existing handlers, but would like a second opinion as to whether that is advisable or whether its best to write our own, based on the wordpress handlers. On Jul 18, 2011 5:28 PM, "ryanglobal" < reply@reply.github.com> wrote:

davidgtonge commented 13 years ago

Here is the default wordpress swfupload handlers javascript file: http://core.trac.wordpress.org/browser/branches/3.2/wp-includes/js/swfupload/handlers.dev.js

mrdavidlaing commented 13 years ago

The default wordpress swfupload handlers look quite tightly coupled with the specific DOM elements on the page.

Can we rename the vspi elements to match those wordpress is expecting, or is the structure of what we use/need just too different?

davidgtonge commented 13 years ago

Hi David,

I've had another look at the code and my suggestion is that we rewrite our own handlers for the following reasons:

  1. The WordPress handlers do more than we need them to
  2. We don't want any conflict between the handlers for the Media Library and the handlers for VSPI
  3. The WordPress handlers may change, and each change would potentially break VSPI
  4. Our code will be a lot cleaner if we write purely the handlers that we need.

I'll have a play around with Swfupload today and see what I can come up with

mrdavidlaing commented 13 years ago

Agreed

On 20 July 2011 09:22, davidgtonge < reply@reply.github.com>wrote:

Hi David,

I've had another look at the code and my suggestion is that we rewrite our own handlers for the following reasons:

  1. The WordPress handlers do more than we need them to
  2. We don't want any conflict between the handlers for the Media Library and the handlers for VSPI
  3. The WordPress handlers may change, and each change would potentially break VSPI
  4. Our code will be a lot cleaner if we write purely the handlers that we need.

I'll have a play around with Swfupload today and see what I can come up with

Reply to this email directly or view it on GitHub:

https://github.com/davidgtonge/Very-Simple-Post-Images/issues/1#issuecomment-1613760

David Laing Open source @ City Index - github.com/cityindex http://davidlaing.com Twitter: @davidlaing

davidgtonge commented 13 years ago

Thanks, I've not had a change to do this yet, hopefully will be able to over the weekend

davidgtonge commented 13 years ago

been tied up with client work, so not had a change to do this yet...