I am using imagekit and wkhtmltoimage to convert html to image. On my local server I am using ubuntu 14.10 and its working fine. But the live server is centos 6 and when I move the code to live server it is showing following libjpeg error:
error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory
Complete error code:
Command failed: /root/.rbenv/versions/2.1.2/bin/wkhtmltoimage --height 470 --width 350 --transparent --quality 60 --format png - -: /root/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/wkhtmltoimage-binary-0.12.1/libexec/wkhtmltoimage-amd64: error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory
Here is my code in controller to create image:
html_content = "<div style='margin:-8px -2px 15px -8px;background:none repeat scroll 0 0 #{temp_params['color']}; direction: #{temp_params['direction']}; font-size: 22px;color: #fff;font-family:arial;line-height: 30px;padding: 15px; height: 470px;width:350px;border-radius: 4px;position:relative;text-align:center;display:table;'><div style='display:table-cell;vertical-align:middle;word-break:break-all;'>#{temp_params['text']}</div></div>"
file = Tempfile.new(["quote", '.png'], 'tmp', :encoding => 'ascii-8bit')
img = IMGKit.new(html_content, height: 470, width: 350, transparent: true, quality:60, :layout => false)
file.write(img.to_img(:png))
temp.attachment = file
file.unlink
temp.save
I have checked solutions provided on various links but none of them worked.