I am hoping that someone can shed light on this problem I am trying to solve, even if simply changing my thought process as to how I could solve this.
I am importing a custom CakePHP based CMS web application into WordPress by means of traversing the database, making numerous SQL queries, building arrays and finally outputting the necessary XML file for import using the WordPress import tool.
Currently I have managed to import categories, tags, and posts / pages just fine, no hiccups, however it is the images that seem to be the issue. The current format of images in the CakePHP based CMS is images/year/month/day/post_id/image_name.ext
As far as I understand, but default WordPress can only store media inside wp-content/uploads or wp-content/uploads/year/month
What I have done is copied over all the image folders from the CakePPH app directory into my WordPress wp-content/uploads directory, so an example image will have this path: http://localhost/wordpress_site/wp-content/uploads/2013/01/01/12345/image.jpg
Inside my WordPress XML file that I am generating, I have set the attachment_url as well as GIUD to be as it is above, referencing the new image I place inside my uploads directory. I even set the file path in the serialzied meta data of the attachment element in the XML.
If I run the import process and DO NOT check the ‘Download and import attachments’ option in WordPress, I get errors that the media cannot be imported…
If I DO check the ‘Download and import attachments’ option, the images ARE located inside the custom path I specified above, but they are resized according to the thumbnail dimensions etc, and the image is still put inside a year/month/image.jpg path. So all WordPress did was read the file at that (custom) location, but still set the final path to a standard WordPress one, moving the image and its generated thumbnails over and away form the desired location.
Does anyone know of a way to simply have the media in a custom path inside the uploads folder AND force WordPress to accept and use that path when running an import?
I understand that via actions and hooks I can change the upload path structure, but only within WordPress and only when uploading media via the post / page / media manager, not during an import. The last thing I want to do is hack the import script.
Any help, guidance, words of advice will be more than appreciated.