×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Featured images

Featured images 10 years 1 month ago #28538

  • Michael Shaw
  • Michael Shaw's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 10
Hello,

Is it possible to also migrate the featured images into joomla articles?

Thanks!
The following user(s) said Thank You: ewhitewhite, ranlaveresteph, aehoshawvergi

Featured images 10 years 1 month ago #28539

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Michael,
Since you've posted in the general talk section without specifying which component you intend to use, I have difficulties figuring out what you mean :)

Regards,
Daniel
The following user(s) said Thank You: ewhitewhite, ranlaveresteph, aehoshawvergi

Featured images 10 years 1 month ago #28543

  • Michael Shaw
  • Michael Shaw's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 10
:lol:
Using the CMigrator component to migrate some content from WP to J! but it's not bringing across the 'featured image'.

Seems the sql is easy enough..
   SELECT
        p1.*,
        wm2.meta_value
    FROM 
        wp_posts p1
    LEFT JOIN 
        wp_postmeta wm1
        ON (
            wm1.post_id = p1.id 
            AND wm1.meta_value IS NOT NULL
            AND wm1.meta_key = "_thumbnail_id"              
        )
    LEFT JOIN 
        wp_postmeta wm2
        ON (
            wm1.meta_value = wm2.post_id
            AND wm2.meta_key = "_wp_attached_file"
            AND wm2.meta_value IS NOT NULL  
        )
    WHERE
        p1.post_status="publish" 
        AND p1.post_type="post"
    ORDER BY 
        p1.post_date DESC

What would be the easiest way to prepend the 'wm2.meta_value' to the joomla article, I wonder?

Sorry for posting in the wrong category, please move this post if you feel the need! :)
The following user(s) said Thank You: ewhitewhite, ranlaveresteph, aehoshawvergi

Featured images 10 years 3 weeks ago #29072

  • Michael Shaw
  • Michael Shaw's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 10
So I updated post content prior to migration like:
UPDATE
	wp_posts wpt
JOIN
( SELECT
	p1.ID,
     concat( '<img src="/blog/', wm2.meta_value, '" />' ) as post_content
    FROM 
        wp_posts p1
    LEFT JOIN 
        wp_postmeta wm1
        ON (
            wm1.post_id = p1.id 
            AND wm1.meta_value IS NOT NULL
            AND wm1.meta_key = "_thumbnail_id"              
        )
    LEFT JOIN 
        wp_postmeta wm2
        ON (
            wm1.meta_value = wm2.post_id
            AND wm2.meta_key = "_wp_attached_file"
            AND wm2.meta_value IS NOT NULL  
        )
    WHERE
        p1.post_status="publish" 
        AND p1.post_type="post"
AND wm2.meta_value is not null
    ORDER BY 
        p1.post_date DESC) as tmp
ON 
	wpt.ID = tmp.ID
SET
	wpt.post_content = concat(tmp.post_content, wpt.post_content)

Maybe this helps someone...
The following user(s) said Thank You: Daniel Dimitrov, ewhitewhite, ranlaveresteph, aehoshawvergi
  • Page:
  • 1
Time to create page: 0.098 seconds