I have a string localhost/uploads/images/photo.jpg
, I just want to simply rename it to localhost/upload/images/photo_thumb.jpg
, keeping in mind that is a dynamic data and am just using it to simply what I want to achieve. I have tried to use the strpos()
function to get the position of the '.' then use it for something(this where I got lost), then another thought came to me use implode. I will appreciate if some can help me figure this out thanks.
<?php
function get_google_image_url($type, $id, $column = 'image', $multi = "",$thumb=''){
if($multi ==''){
//check if there is thumbnail add _thumb before extention
if($thumb != ''){
$l= $this->db->get_where($type,array($type.'_id'=>$id));
$n = $l->num_rows();
if($n >0){
$value = $l->row()->$column;
$position = strripos($value,'.');
return $l->row()->$column;
}
}else{
$l= $this->db->get_where($type,array($type.'_id'=>$id));
$n = $l->num_rows();
if($n >0){
/$value = $l->row()->$column
$position = strripos($value,'.');
//this where i got stucked
//return $l->row()->$column;
}
}
}
}
that's the function am trying to implement it in, but what I want to achieve is what I stated above.