Answer the question
In order to leave comments, you need to log in
How to substitute a string for the value of a variable?
There is a line _huge_it_small_gallery .
There is a variable that contains the full path to the image.
Example:
/uploads/2015/12/header3.jpg
Help me figure out how to make it so that it would turn out like this:
/uploads/2015/12/header3_huge_it_small_gallery.jpg
Here is my forych:
foreach ($query as $img) {
$carouselItems .= '<li><a href="'.$img->image_url.'" class="carouselItem" rel="fancyboxCarousel'.$id.'"><img src="'.$img->image_url.'"></a></li>';
}
Answer the question
In order to leave comments, you need to log in
<?php
foreach ($query as $img) {
$img->image_url = str_replace(".jpg", "_huge_it_small_gallery.jpg", $img->image_url);
$carouselItems .= '<li><a href="'.$img->image_url.'" class="carouselItem" rel="fancyboxCarousel'.$id.'"><img src="'.$img->image_url.'"></a></li>';
}
if you don't sweat
Either you cut the file resolution, shove between the line _huge_it_small_gallery and collect everything together
or regular expressions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question