Ask your WordPress questions! Pay money and get answers fast! (more info)

Link to image in different folder (php + Meta slider and Carousel with Lightbox) WordPress

  • SOLVED

I'm using the Meta slider and Carousel with Lightbox-plugin of wponlinesupport, which images will open in the same size in a popup.

Now I have a different folder with the same images in high-resolution and want the smaller image to open a popup with the hi-res-picture.

The code by now is this:

<div class="msacwl-img-wrap" <?php echo $slider_height_css; ?>>
<?php if( $popup ) { ?>
<a class="msacwl-img-link" href="<?php echo $gallery_img_src; ?>"></a>
<?php } ?>
<img class="msacwl-img" src="<?php echo $gallery_img_src ?>" title="<?php echo wp_igsp_pro_esc_attr($post_meta_data->post_title); ?>" alt="<?php echo wp_igsp_pro_esc_attr($image_alt_text); ?>" />
</div>

So I need something working like:

<div class="msacwl-img-wrap" <?php echo $slider_height_css; ?>>
<?php if( $popup ) { ?>
<a class="msacwl-img-link" href="<?php echo HI_RES_FOLDER/$gallery_img_src; ?>"></a>
<?php } ?>
<img class="msacwl-img" src="<?php echo $gallery_img_src ?>" title="<?php echo wp_igsp_pro_esc_attr($post_meta_data->post_title); ?>" alt="<?php echo wp_igsp_pro_esc_attr($image_alt_text); ?>" />
</div>

If you need further information or have any questions don't hesitate to contact me!
I appreciate any solutions and recommandations.

Thank you very much in advance!

Answers (2)

2017-07-20

Francisco Javier Carazo Gil answers:

Ok perfect, so what you need is a str_replace of folders. I prepare the code and tell you.

<?php
$gallery_img_src_high_resolution = str_replace("old_directory_url", "new_directory_url", $gallery_img_src);
?>
<div class="msacwl-img-wrap" <?php echo $slider_height_css; ?>>
<?php if( $popup ) { ?>
<a class="msacwl-img-link" href="<?php echo $gallery_img_src_high_resolution; ?>"></a>
<?php } ?>
<img class="msacwl-img" src="<?php echo $gallery_img_src ?>" title="<?php echo wp_igsp_pro_esc_attr($post_meta_data->post_title); ?>" alt="<?php echo wp_igsp_pro_esc_attr($image_alt_text); ?>" />
</div>


Francisco Javier Carazo Gil comments:

Tell me if you have any problem please!


User178986 comments:

Awesome! Works right out of the box!
Thank you very much for your excellent help! :-D

2017-07-20

Arnav Joy answers:

where is different directory exists ??