PDA

View Full Version : Addon: Import from Movable Types (MT)


raminia
07-08-2005, 10:30 AM
An addon for importing photos (photoblog) from Movable Types.
Version 0.1 @ 2005-07-08

Download from:
http://www.pixelpost.org/v1/index.php?x=downloads&details=86 (temporary)
OR
http://www.pixelpost.org/v1/index.php?x=downloads&details=86

Requirements:
PIXELPOST VERSION 1.4 or Pixelpost 1.3 with multi category modification.
PHP 4.0.3+
MT 3.x *
MySQL database only!

* This is basically for MT 3.x but it should work for MT 2
Features:
- You can specify MT post id range to import to Pixelpost.
- Avoids overwrites when asked.
- Copies files to Pixelpost directory or moves them on user request.
- Sets Title and body content automatically.
- Supports multiple images in a single post of MT and converts it into seperate posts on PP.
- Creates thumbnails automatically.

What is not supported
- support Different datetime for images in a single post of WP when they are converted into seperated PP posts.
- Different users of MT is ignored. PP 1.4.1 supports only one user.
- other DBs rather than MySQL are not supported yet.


Instructions:
1- Copy htmlparser.inc into includes folder of PP.
2- Copy import_from_mt.php into the addons folder of PP.
3- Open addon page in pixelpost admin pane and go to the section that this addon owns. it's a clear form that you should fill it with your wp-cofig.php info of mt.cfg.
4- Pixelpost 1.4.1 users only: To add the UTF-8 support fix a bug in includes/functions.php. Open the file and commentout line 105 to //$str = UTF8_encode($str); and line line 115 to //$str = UTF8_decode($str);. This is fixed in next versions.

TommyBlue
12-03-2005, 07:23 AM
Ah, it's fantastic you made this plugin, raminia! But I'm having a problem.. I put in all the required info into the addon page and specified some posts to import and it gives me this error message:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/consciou/public_html/blinkpp/addons/import_from_mt.php on line 78

I don't know what could be causing that, but I'll keep fiddling around and hope you get this message and are able to help... Thanks!
-Tommy

TommyBlue
12-03-2005, 07:35 AM
One more thing, Raminia, if I don't specify any posts to import and just leave the fields blank, it gives me this error for each and every image in my source image path:

Warning: copy(/public_html/blink/photoarchive/Curiosity.jpg): failed to open stream: No such file or directory in /home/consciou/public_html/blinkpp/addons/import_from_mt.php on line 139

Thanks for your help with this!
-Tommy

raminia
12-03-2005, 08:23 AM
Ah, it's fantastic you made this plugin, raminia! But I'm having a problem.. I put in all the required info into the addon page and specified some posts to import and it gives me this error message:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/consciou/public_html/blinkpp/addons/import_from_mt.php on line 78

I don't know what could be causing that, but I'll keep fiddling around and hope you get this message and are able to help... Thanks!
-Tommy
please tell me which version of pixelpost you are using and also what is your MT version.

TommyBlue
12-04-2005, 12:04 AM
I'm using PixelPost 1.4.3 and MT 3.2, both the newest versions I believe.
Look forward to your reply, thanks.
-Tommy

raminia
12-04-2005, 06:38 AM
I'm using PixelPost 1.4.3 and MT 3.2, both the newest versions I believe.
Look forward to your reply, thanks.
-Tommy
you might not entered the sql db information correctly.

add this line to line 72 of import_from_mt.php
echo $query."<br/>";
and tell me what it wrote on the screen when running it. I want to see the query for bug fixing.

TommyBlue
12-06-2005, 12:29 AM
Okay I added that code on line 72, and here's what I get:

Top of the page:

select entry_id,entry_title,entry_text,entry_created_on,e ntry_modified_on,entry_status,entry_blog_id from mt_entry , mt_blog where mt_blog.blog_id = mt_entry.entry_blog_id AND mt_blog.blog_name ='Blink! Photoblog' AND mt_entry.entry_text LIKE '%%'order by mt_entry.entry_created_on asc


Then most of the errors are like the first one below. There's a couple "No such file" errors I don't know why, and this time it ended before errors for all images with that last one:

Warning: Invalid argument supplied for foreach() in /home/consciou/public_html/blinkpp/addons/import_from_mt.php on line 307

Warning: copy(/home/consciou/public_html/blink/photoarchive/Mom%27s.jpg): failed to open stream: No such file or directory in /home/consciou/public_html/blinkpp/addons/import_from_mt.php on line 139

Fatal error: Maximum execution time of 30 seconds exceeded in /home/consciou/public_html/blinkpp/addons/import_from_mt.php on line 365

If you need me to do anything else different, let me know.
Thanks!

raminia
12-06-2005, 04:26 AM
the problem resides here I think
LIKE '%%'order by

it's not valid a argument. i'll test it tonight (it's 8am here)

TommyBlue
12-06-2005, 05:29 AM
Cool, take your time, raminia... 'preciate your help!
-Tommy

TommyBlue
12-10-2005, 08:54 PM
Hmmm, it's been a few days.. just hoping you've come up with something to help me, raminia. Any luck? Do you need any more info from me? Thanks.

raminia
12-10-2005, 09:00 PM
Hmmm, it's been a few days.. just hoping you've come up with something to help me, raminia. Any luck? Do you need any more info from me? Thanks.
yeah... one other user that I hade a long chat online and we had many progress in bug fixing this addon. I'll ask him to write here about it.

raminia
12-12-2005, 06:32 PM
before releasing the new version I'll post the older version here.

raminia
12-12-2005, 06:50 PM
Version 1.0 released:
Now, bug fixed and compatible with MT 2.x as well!

Version 1.0:
Bug fixed by: Wilson Lam
Also Modified to be compatible with earlier versions MT: 2.661
Contact: wilson@photokit.net
Visit: http://www.photokit.net


Known bugs of previous version (0.3) and fixed in 1.0:
1- Does not import all photos in one go! Only imports
in groups of 50s. (for example: 1 to 50, 51 to 100
etc..)
2- This template assumes that <img src= .. > tag is in
the "entry field" and your image text might be in the
"extended entry" field.
3- Duplicated comments!
4- increased maximum execution time but it's highly recommended to import post in small group not all at once since the script would face timeout error in a long execution.

Download:
http://www.pixelpost.org/v1/index.php?x=downloads&details=86

TommyBlue
12-16-2005, 11:45 PM
Thanks so much for fixing it, both of you! It works great now, except for one thing you might want to know... Anytime there's a multiple image post in MT, the import log gives me this for each picture after the first:

Warning: Invalid argument supplied for foreach() in /home/consciou/public_html/blinkpp/addons/import_from_mt.php on line 341

It still adds them to the database, so no big deal, but I thought I'd let you know. Thanks again!
-Tommy

TommyBlue
12-17-2005, 09:25 PM
I'll clarify this more-- that error only occurs when there are no posted comments to the given image... Which isn't a problem, but is probably really easy to fix, no? I had an annoying issue with it importing the junked comments from MT, so I had to reset my database and try again after deleting all the junked comments in MT. All is well now, thanks so much for your support!

raminia
12-18-2005, 05:45 AM
I'll clarify this more-- that error only occurs when there are no posted comments to the given image... Which isn't a problem, but is probably really easy to fix, no? I had an annoying issue with it importing the junked comments from MT, so I had to reset my database and try again after deleting all the junked comments in MT. All is well now, thanks so much for your support!
please delete all junk comments (and comments that are not allowed to show up) before importing. In this version import script does not consider that to be compatible with both 2.x and 3.x. Actually for 3.x there should be some other version but I missed doing that. Thanks for bug report.

TommyBlue
12-29-2005, 06:14 AM
Ah, I have another comment/feature request...
The plugin doesn't seem to have imported any of my Extended Entry HTML tags like <br /> and <em>... I've started to go back through 200+ entries to add them manually, but it'd be great if you could add that functionality to the plugin!
Thanks,

raminia
12-29-2005, 02:19 PM
yeah it killes the html tags. the reason was for simplicity. Actually the code needs to kill any img tag and keep the rest but I did it in the simplest way. If someone is there that could do this or have ideas about it please contact me.