Write a function or plugin for WordPress
- Status: Closed
- Prize: $50
- Entries Received: 1
- Winner: bowenac
Contest Brief
Rebuilding a WordPress site, a community of 4000+ active authors. The previous version had a custom front-end upload script allowing authors to create posts. Every post has one image followed by some text. The images were uploaded into normal uploads/year/month folders, BUT they're not in the library. There are over 20,000 posts, every post contains a string like this:
a href="http://www.mysite.com/wp-content/themes/prologue/phpThumb/phpThumb.php?src=../../../../wp-content/uploads/2010/03/4b94f1e580cc119.jpg"
So the images are displayed by phpThumb. And I want to get rid of that. Here's what I need to do:
For every post of post_type post, grab its post_content. Extract the image file name string:
http://www.mysite.com/wp-content/themes/prologue/phpThumb/phpThumb.php?src=../../../../wp-content/uploads/2010/03/4b94f1e580cc119.jpg)
Then turn that string into the actual file's location by removing all phpThumb stuff in the middle, so it becomes
http://www.mysite.com/wp-content/uploads/2010/03/4b94f1e580cc119.jpg
Take this new string, and programmatically add that image to the library, so it would create a normal set of thumbnails in the same uploads/year/month directory
Attach the new library image to the post we're processing at the moment
Also set this new library image as a featured image for this same post
Repeat 20,000 times
Recommended Skills
Public Clarification Board
How to get started with contests
-
Post Your Contest Quick and easy
-
Get Tons of Entries From around the world
-
Award the best entry Download the files - Easy!