Hello @mungorodnaneve
I have been thinking about your issue for a while now and it seems I too have always had issues with attaching images to WP post types via importing data. Give me some time to step-through how WordPress treats image attachments and how my code interacts with it.
How are the actual book cover images named in your system, is there a pattern to it?
On my site book covers placed in libs/ directory and all named
like {id-of-book}-gorodnaneve-com.jpg ( id tooked from calibre software and placed in custom taxomonie (bids) in recencio.)
so full path to image is gorodnaneve.com/ru/uploads/libs/7837-gorodnaneve-com.jpg
Some addition – Fetch Book Cover extension is turned off.
Book Cover Custom URL setting – is on.
Default WP Taxonomy setting – is off.
And i have Media library assistant that shows me that attachment metadata of image is:
‘rcno-book-cover-lg’ =>
array (
‘file’ => ‘7837-gorodnaneve-com-380×500.jpg’,
‘width’ => 380,
‘height’ => 500,
‘mime-type’ => ‘image/jpeg’,
),
‘rcno-book-cover-sm’ =>
array (
‘file’ => ‘7837-gorodnaneve-com-85×130.jpg’,
‘width’ => 85,
‘height’ => 130,
‘mime-type’ => ‘image/jpeg’,
),
and other images that were not attached like book cover but like post image have that sizes too.
Maybe this info helps.
I have another question to you, Master =) :
While import, I added description of every book in excerpt field, because I dont have Book Description/synopsis field in import.
And now I see that the default template uses Book Description/synopsis text. Its a problem too – to copy/past all them by hand.
Maybe there is some solution to copy all automatically? SQL? changing template code?
Thanks for helping!!
Hello again,
In your example, is the Calbre ID (the 7837 number) of the book stored in any of the book’s custom meta on the WordPress website?
If not, if you can you create a new custom meta using the “Custom User Metadata” extension called “Calibre ID”. Then using the WP All Import plugin add the value of each book’s Calibre ID to the “rcno_calibreid_meta” custom meta field.
Then I can give code that will generate a book cover for each book.
Hey, thanks for quick reply. I added that metadata field, tried to import to it, but nothing was added, because I have a free version of All import plugin, and for custom fields update i need paid. I search now for alternative plugin..
All my calibre ids of the book stored is the taxonomy called bids gorodnaneve.com/libs/bids/7837/ (example for 7837 calibre id)
I really dont want to strain you with my problems.. Is there another way to generate a book cover without meta field creation? Maybe using taxomonies, or meta-field inside image that already attached? I still continue search the way to update that “Calibre ID” meta field without pay for plugin..
@w33zy , Wow!, I’ve done it! I use WP Imp Exp plugin https://wordpress.org/plugins/wp-import-export-lite/ it looks like WP All import plugin, but with custom fields functions. First I export my libs, then used Notepad++ changed the fields(I could not doing this, but it helped with names of fields.
I added this fields to each book:
<rcno_reviews_book_cover_url><![CDATA[https://gorodnaneve.com/ru/uploads/libs/7837-gorodnaneve-com.jpg]]></rcno_reviews_book_cover_url>
<imagesfilename><![CDATA[7837-gorodnaneve-com.jpg]]></imagesfilename>
<rcno_reviews_book_cover_src><![CDATA[https://gorodnaneve.com/ru/uploads/libs/7837-gorodnaneve-com.jpg]]></rcno_reviews_book_cover_src>
<rcno_reviews_book_cover_id><![CDATA[29665]]></rcno_reviews_book_cover_id>
<rcno_reviews_book_cover_title><![CDATA[7837-gorodnaneve-com]]></rcno_reviews_book_cover_title>
and they were
<imageurl><![CDATA[https://gorodnaneve.com/ru/uploads/libs/1071-gorodnaneve-com.jpg]]></imageurl>
<imagesfilename><![CDATA[1071-gorodnaneve-com.jpg]]></imagesfilename>
<imagespath><![CDATA[/is/htdocs/*******_********/www/ru/uploads/libs/1071-gorodnaneve-com.jpg]]></imagespath>
<imagesid><![CDATA[27837]]></imagesid>
<imagestitle><![CDATA[1071-gorodnaneve-com]]></imagestitle>
(**** -is my full path that added to attachment in book)
—also i added rcno_description field
—Maybe its not a good solution but it helps in my situation.. I dont know, but maybe you should pay attention to fix problem on that is <imagespath> was the full path and <rcno_reviews_book_cover_src> is like <rcno_reviews_book_cover_url> the same. Its my opinion. By the way thank you for that good plugin, good luck!