Importing pictures from nucleus

Having trouble installing serendipity?
Post Reply
ihra
Regular
Posts: 26
Joined: Thu Sep 21, 2006 11:15 am

Importing pictures from nucleus

Post by ihra »

Hello,

nucleus/Blog:CMS import works like a charm. Only problem is images in articles.

Currently images are like:

Code: Select all

<div class="leftbox"><%image(public/20040906-hovimaki.jpg|127|200|Hovimäki)%>
</div>
So there is path ({site.com/media/}public/ and imagename (20040906-hovimaki.jpg), size (width=127, height=200) and comment (Hovimäki).

So... to make regexp after importing articles (or during it), what do I change that string?

I looked few examples how serendipity saves images to article body / extended part, but ...

Code: Select all

<div class="serendipity_imageComment_left" style="width: 110px"><!--s9ymdb:1--><img width='110' height='83' src="/uploads/hovimaki.serendipityThumb.jpg" alt=""/></div><div class="serendipity_imageComment_txt">Hovimäki</div></div>
I can figure out where to put comment texts, but should I insert filename + serendipityThumb.jpg -text? Problem is that I have more than 1200 articles from the past 5 years and they contain lots of pictures (that I need to upload to /upload and build thumbnails?).

What is the meaning of s9ymdb:1 -text? Media Database? How come that number is always "1" even if I bring 2 or more pictures to article.

I created the import part but just can't figure out what to put there...
Examples of articles are:
http://www.nominaali.com/~ihra/serendipity/
and single article that contains picture:
http://www.nominaali.com/~ihra/serendip ... enity.html
(get it? get it? :))

p.s. can't use rss as there won't be pictures along it... and no way that I am gonna do it manually, I am using IT after all ;)
...ihra / ukki / Jussi Josefsson
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Importing pictures from nucleus

Post by garvinhicking »

Hi!

I think the best way would be to create a SQL Dump of your nucleus-Database, then use an editor to apply your regex on the SQL dump, and then import the SQL-Dump; after that, you can use the nucleus importer from serendipity. This way you won't have performance issues that regexps need to be performed every time, and you don't need to code a plugin to perform the replacement or patch the import function of serendipity.

The file part ".serendipityThumb." comes when serendipity creates a thumbnail, yes. So you could basically just use a regexp that replaces ".jpg" with ".serendipityThumb.jpg" and the same with ".png".

Then upload all your images via FTP, and then go to the s9y interface to click on "Synchronize Thumbnails" or "Rebuild Thumbnails", I don't remember the exact title. Then all thumbnails will be created from your files. Of course, if you already have thumbnails that you upload, the best way would be to put them into the ".serendipitYthumb." naming scheme.

The "<!--s9ymdb-->" string just refers to the ID of an image that is uploaded to the s9y media database (Table serendipity_images). It currently only serves for future compatibility, but you don't really need that part currently.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ihra
Regular
Posts: 26
Joined: Thu Sep 21, 2006 11:15 am

Re: Importing pictures from nucleus

Post by ihra »

garvinhicking wrote:Hi!

I think the best way would be to create a SQL Dump of your nucleus-Database, then use an editor to apply your regex on the SQL dump, and then import the SQL-Dump; after that, you can use the nucleus importer from serendipity. This way you won't have performance issues that regexps need to be performed every time, and you don't need to code a plugin to perform the replacement or patch the import function of serendipity.
Yes, that is exactly what I am doing... or rather, I have small php script that does mysql altering after import to change imagelinks correct.
garvinhicking wrote: The file part ".serendipityThumb." comes when serendipity creates a thumbnail, yes. So you could basically just use a regexp that replaces ".jpg" with ".serendipityThumb.jpg" and the same with ".png".
Then upload all your images via FTP, and then go to the s9y interface to click on "Synchronize Thumbnails" or "Rebuild Thumbnails", I don't remember the exact title. Then all thumbnails will be created from your files. Of course, if you already have thumbnails that you upload, the best way would be to put them into the ".serendipitYthumb." naming scheme.
As I have time, I think I try rebuilding thumbs, as I have used 3-4 different cms over time and they haven't been rebuild to standard size before.
garvinhicking wrote: Garvin
Thanks, I ordered a book to you from your wishlist, IF my german "skill" was enough to guess same steps as they are in english :)
...ihra / ukki / Jussi Josefsson
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Importing pictures from nucleus

Post by garvinhicking »

Hi ihra!

Okay, I hope your import will work fine. :)

Thanks for ordering the book! I also hate that amazon does not offer an enlgish interface - it makes no sense to only offer german. :(

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ihra
Regular
Posts: 26
Joined: Thu Sep 21, 2006 11:15 am

Post by ihra »

Heh, converted all of those pictures away. I did regexp based conversion few times and my problem is that I have used 3 different imageutilities with Nucleus/Blog:CMS and those each uses different plugins with different settings (%Image, %image, %IMAGE) etc. And after I did thumbnail conversion / rebuild, I did have to do another conversion... and another... and some of the thumbnails didn't work (might be corrupted / incompatible files, like tiff / bmp / iff). After fiddling about two hours of conversions, I choose it is better to take all those pictures away and import those I want back manually (about 650 articles contain images, but only about 200+ is needed). It is faster to do about 2 hours worth of pictureimport manually than 5 hours of automated import :)

Because of linking and webrobots, my viewed-counters are totally unreliable and inaccurate, thus I also decided not to put those to karma-based ratings/views.

Hopefully this week I finish my conversions and can concentrate to templates and plugins.
...ihra / ukki / Jussi Josefsson
Post Reply