This is driving me up the wall! I'm using the "Migrate DB" plugin to export the DB for the new server. I have a double change as in we are moving server, and also domain.
->
So I've told it to replace:
When I put that on the new server's DB, the site does work for the most part - but some images are missing:
I can see the media in question in the "Media" part of the admin panel, so I know the image is fine. However, if I look at the source code on the site I get:
<img class="alignleft" src="" alt="Testimonial" title="Ryan Anderson"/>
I'm sure I'm doing everything right! Have I missed something? I always seem to have fun and games moving sites from http
to https
and a new path :/
UPDATE: As requested, I've tried to follow the code - its a bit of a hole!
This is the code in the template that is outputting the image:
<?php mo_thumbnail(array(
'before_html' => '<p>',
'after_html' => '</p>',
'image_size' => 'square',
'image_class' => 'alignleft',
'wrapper' => false,
'image_alt' => 'Testimonial',
'size' => 'full'
)); ?>
That function then leads onto:
function mo_thumbnail($args) {
$thumbnail_element = mo_get_thumbnail($args);
if (!empty($thumbnail_element)) {
echo $thumbnail_element;
return true;
}
return false;
}
...and that follows into this function:
function mo_get_thumbnail($args) {
global $mo_theme;
$context = $mo_theme->get_context('loop');
$defaults = array(
'format' => 'array',
'size' => 'full',
'image_scan' => false,
'youtube_scan' => false,
'wrapper' => true,
'show_image_info' => false,
'before_html' => '',
'after_html' => '',
'image_class' => 'thumbnail',
'image_alt' => '',
'image_title' => '',
'meta_key' => array(),
'style_size' => false,
'the_post_thumbnail' => true,
// Keep this true to enable featured posts
'force_aqua_resizer' => true,
'taxonomy' => 'category',
'cache' => false,
// WordPress handles image caching for you.
);
$args = wp_parse_args($args, $defaults);
/* Extract the array to allow easy use of variables. */
extract($args);
$output = '';
if (empty($image_size)) {
$thumbnail_urls = mo_get_original_image_urls($args);
}
else {
//image_size can be an array with height and width key value pairs or a string
if (is_string($image_size)) {
$image_size = mo_get_image_size_array($image_size);
$args['force_aqua_resizer'] = false; // we have the wp sizes taken care of
}
$args['height'] = $image_size['height'];
$args['width'] = $image_size['width'];
$thumbnail_urls = mo_get_thumbnail_urls($args);
}
//create the thumbnail
if (!empty($thumbnail_urls)) {
$thumbnail_src = $thumbnail_urls[0];
$thumbnail_element = $thumbnail_urls[1];
if (empty($post_id))
$post_id = get_the_ID();
$post_title = get_the_title($post_id);
$post_link = get_permalink($post_id);
$post_type = get_post_type($post_id);
$rel_attribute = 'rel="prettyPhoto[' . $context . ']" ';
if ($post_type === 'gallery_item') {
// Make the anchor to gallery thumbnail point to the image directly
$before_html = '<a title="' . $post_title . '" href="' . $thumbnail_src . ' ">';
$after_html = '</a>' . $after_html;
if ($wrapper) {
$wrapper_html = '<div class="image-area">';
$before_html = $wrapper_html . $before_html;
if (mo_show_image_info($context) || $show_image_info) {
$image_info = '<div class="image-overlay"></div>';
$image_info .= '<div class="image-info">';
$image_info .= '<div class="post-title">' . $post_title . '</div>'; // do not link to post for gallery
$image_info .= mo_get_taxonomy_info($taxonomy);
$image_info .= '<div class="image-info-buttons">'; // Make this part of the link itself
$image_info .= '<a class="lightbox-link button transparent"' . $rel_attribute . 'title="' . $post_title . '" href="' . $thumbnail_src . ' ">' . __('Expand', 'mo_theme') . '</a>';
$image_info .= '</div>';
$image_info .= '</div>';
$after_html .= $image_info;
}
$after_html .= '</div>'; // end of image-area
}
}
else {
if (empty($before_html)) {
$before_html = '<a title="' . $post_title . '" href="' . $post_link . ' ">';
$after_html = '</a>' . $after_html;
}
if ($wrapper) {
$wrapper_html = '<div class="image-area">';
$before_html = $wrapper_html . $before_html;
if (mo_show_image_info($context) || $show_image_info) {
$image_info = '<div class="image-overlay"></div>';
$image_info .= '<div class="image-info">';
$image_info .= '<div class="post-title"><a title="' . $post_title . '" href="' . $post_link . ' ">' . $post_title . '</a></div>';
$image_info .= mo_get_taxonomy_info($taxonomy);
$image_info .= '<div class="image-info-buttons">';
// point me to the source of the image for lightbox preview
$image_info .= '<a class="lightbox-link button transparent"' . $rel_attribute . 'title="' . $post_title . '" href="' . $thumbnail_src . ' ">' . __('Expand', 'mo_theme') . '</a>';
$image_info .= '<a class="post-link button transparent" href="' . $post_link . '" title="' . $post_title . '">' . __('Details', 'mo_theme') . '</a>';
$image_info .= '</div>';
$image_info .= '</div>';
$after_html .= $image_info;
}
$after_html .= '</div>'; // end of image-area
}
}
$output = $before_html;
$output .= $thumbnail_element;
$output .= $after_html;
}
return $output;
}
This is driving me up the wall! I'm using the "Migrate DB" plugin to export the DB for the new server. I have a double change as in we are moving server, and also domain.
http://thebodywisegym.co.uk -> https://bodywisegym.co.uk
So I've told it to replace:
When I put that on the new server's DB, the site does work for the most part - but some images are missing:
I can see the media in question in the "Media" part of the admin panel, so I know the image is fine. However, if I look at the source code on the site I get:
<img class="alignleft" src="" alt="Testimonial" title="Ryan Anderson"/>
I'm sure I'm doing everything right! Have I missed something? I always seem to have fun and games moving sites from http
to https
and a new path :/
UPDATE: As requested, I've tried to follow the code - its a bit of a hole!
This is the code in the template that is outputting the image:
<?php mo_thumbnail(array(
'before_html' => '<p>',
'after_html' => '</p>',
'image_size' => 'square',
'image_class' => 'alignleft',
'wrapper' => false,
'image_alt' => 'Testimonial',
'size' => 'full'
)); ?>
That function then leads onto:
function mo_thumbnail($args) {
$thumbnail_element = mo_get_thumbnail($args);
if (!empty($thumbnail_element)) {
echo $thumbnail_element;
return true;
}
return false;
}
...and that follows into this function:
function mo_get_thumbnail($args) {
global $mo_theme;
$context = $mo_theme->get_context('loop');
$defaults = array(
'format' => 'array',
'size' => 'full',
'image_scan' => false,
'youtube_scan' => false,
'wrapper' => true,
'show_image_info' => false,
'before_html' => '',
'after_html' => '',
'image_class' => 'thumbnail',
'image_alt' => '',
'image_title' => '',
'meta_key' => array(),
'style_size' => false,
'the_post_thumbnail' => true,
// Keep this true to enable featured posts
'force_aqua_resizer' => true,
'taxonomy' => 'category',
'cache' => false,
// WordPress handles image caching for you.
);
$args = wp_parse_args($args, $defaults);
/* Extract the array to allow easy use of variables. */
extract($args);
$output = '';
if (empty($image_size)) {
$thumbnail_urls = mo_get_original_image_urls($args);
}
else {
//image_size can be an array with height and width key value pairs or a string
if (is_string($image_size)) {
$image_size = mo_get_image_size_array($image_size);
$args['force_aqua_resizer'] = false; // we have the wp sizes taken care of
}
$args['height'] = $image_size['height'];
$args['width'] = $image_size['width'];
$thumbnail_urls = mo_get_thumbnail_urls($args);
}
//create the thumbnail
if (!empty($thumbnail_urls)) {
$thumbnail_src = $thumbnail_urls[0];
$thumbnail_element = $thumbnail_urls[1];
if (empty($post_id))
$post_id = get_the_ID();
$post_title = get_the_title($post_id);
$post_link = get_permalink($post_id);
$post_type = get_post_type($post_id);
$rel_attribute = 'rel="prettyPhoto[' . $context . ']" ';
if ($post_type === 'gallery_item') {
// Make the anchor to gallery thumbnail point to the image directly
$before_html = '<a title="' . $post_title . '" href="' . $thumbnail_src . ' ">';
$after_html = '</a>' . $after_html;
if ($wrapper) {
$wrapper_html = '<div class="image-area">';
$before_html = $wrapper_html . $before_html;
if (mo_show_image_info($context) || $show_image_info) {
$image_info = '<div class="image-overlay"></div>';
$image_info .= '<div class="image-info">';
$image_info .= '<div class="post-title">' . $post_title . '</div>'; // do not link to post for gallery
$image_info .= mo_get_taxonomy_info($taxonomy);
$image_info .= '<div class="image-info-buttons">'; // Make this part of the link itself
$image_info .= '<a class="lightbox-link button transparent"' . $rel_attribute . 'title="' . $post_title . '" href="' . $thumbnail_src . ' ">' . __('Expand', 'mo_theme') . '</a>';
$image_info .= '</div>';
$image_info .= '</div>';
$after_html .= $image_info;
}
$after_html .= '</div>'; // end of image-area
}
}
else {
if (empty($before_html)) {
$before_html = '<a title="' . $post_title . '" href="' . $post_link . ' ">';
$after_html = '</a>' . $after_html;
}
if ($wrapper) {
$wrapper_html = '<div class="image-area">';
$before_html = $wrapper_html . $before_html;
if (mo_show_image_info($context) || $show_image_info) {
$image_info = '<div class="image-overlay"></div>';
$image_info .= '<div class="image-info">';
$image_info .= '<div class="post-title"><a title="' . $post_title . '" href="' . $post_link . ' ">' . $post_title . '</a></div>';
$image_info .= mo_get_taxonomy_info($taxonomy);
$image_info .= '<div class="image-info-buttons">';
// point me to the source of the image for lightbox preview
$image_info .= '<a class="lightbox-link button transparent"' . $rel_attribute . 'title="' . $post_title . '" href="' . $thumbnail_src . ' ">' . __('Expand', 'mo_theme') . '</a>';
$image_info .= '<a class="post-link button transparent" href="' . $post_link . '" title="' . $post_title . '">' . __('Details', 'mo_theme') . '</a>';
$image_info .= '</div>';
$image_info .= '</div>';
$after_html .= $image_info;
}
$after_html .= '</div>'; // end of image-area
}
}
$output = $before_html;
$output .= $thumbnail_element;
$output .= $after_html;
}
return $output;
}
Share
Improve this question
edited Apr 26, 2019 at 7:53
Andrew Newby
asked Apr 26, 2019 at 7:24
Andrew NewbyAndrew Newby
2093 silver badges13 bronze badges
16
- show us the php code where you call the image url – Vishwa Commented Apr 26, 2019 at 7:37
- @Vishwa - it seems to be a bit long-winded! I'll update my post in a second – Andrew Newby Commented Apr 26, 2019 at 7:52
- 1 im not sure this is the right code. are you sure this is the php code for your homepage? – Vishwa Commented Apr 26, 2019 at 10:05
- 1 I'm sure it's fixable, anyway I'm not sure that I can tellmore without actually seeing the code myself, sorry about that. outdated doesnt mean that you should abandon it, but yoy may have to take some additional steps yourself to ensure smooth delivery. thats all – Vishwa Commented Apr 28, 2019 at 7:36
- 1 glad to be a help anytime.. – Vishwa Commented Apr 29, 2019 at 5:50
1 Answer
Reset to default 1Why don't you use Duplicator – WordPress Migration Plugin for migration?. I have also used same plugin used by you for migration but Duplicator is far better then other migration plugins. I think this problem can be resolve by using above plugin.