Ticket #6430 (accepted enhancement)
WordPress 2.5 xmlrpc should return image thumbnail URLs in wp.uploadFile
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | XML-RPC | Version: | 2.5 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | josephscott, redsweater, jonquark |
Description
The xmlrpc call for wp.uploadFile (aliased to mw_newMediaObject) currently returns the URL of the uploaded file only. In WordPress 2.5, thumbnail files are automatically created. The xmlrpc API should provide a way to get the URLs of the thumbnail files, preferably in the returned hash from the wp.uploadFile call.
That is, wp.uploadFile currently returns url = " http://myhost/wp/wp-content/uploads/2008/03/myImage.jpg". In addition, it should return "thumbnailSmallUrl = ..." and "thumbnailMediumUrl = ...". (I'm not sure if this would break MetaWeblog compatibility.)
Background:
WordPress 2.5 now automatically creates thumbnail images for uploaded image files according to the (maximum) sizes specified in the Miscellaneous settings page. When resizing, the aspect ratio is maintained, and the filenames are named for the exact size of the image. For example, if I upload:
dsc-0151.jpg
Using the default thumbnail settings of 150x150 and 300x300, these files will be created: dsc-0151-300x199.jpg dsc-0151-150x150.jpg
Note that the first filename for the medium thumbnail is called "300x199" not "300x300". It's thus difficult to guess the new thumbnail filename for the default settings.
Since these settings are user configurable, it's currently impossible for an xmlrpc client to guess the URLs of the thumbnails.
Attachments
Change History
comment:1
josephscott — 4 years ago
- Cc josephscott added
- Type changed from defect to enhancement
- Component changed from General to XML-RPC
comment:3
redsweater — 4 years ago
- Cc redsweater added
This is a great suggestion. I would also like to be able to offer WordPress-generated thumbnails to my users.
- Keywords needs-patch added
- Milestone changed from 2.9 to Future Release
-
attachment
thumbnailurl.patch
added
Patch to add urls for resized images to the response
- Cc jonquark added
- Keywords has-patch added; needs-patch removed
- Status changed from new to accepted
- Owner changed from anonymous to jonquark
It's my first Wordpress patch, please review it harshly.
I've created a (hopefully) temporary plugin to add this functionality: http://wordpress.org/extend/plugins/imageurlreturner/ until this item is closed.
-
attachment
thumbnail.patch
added
Patch to return urls for smaller images for xmlrpc uploads
I've just updated the patch so it now applies to trunk revision 15490 (checked out this evening).
Now 3.0 is out and stable, is now a good time to ask for this patch to be applied?
I've added another version of the patch (against rev. 15853).
In addition to keeping up with trunk changes, I've fixed a problem where the urls weren't returned correctly when two files of the same name were uploaded to the server.
(Thanks to multiple people for pointing out the problem which they encountered using the plugin equivalent to this patch).
I'd be really grateful if the patch could be applied...
v4 of the patch now added
(v3 of the patch had inadvertent changes due to mistaken forward porting from the original patch)
comment:10
josephscott — 16 months ago
Perhaps we should look at returning the same set of data provided by the new wp.getMediaItem method - #15151
