• How resize this string.

    Original file = mydomain.com/wp-content/uploads/2015/01/name-file.jpg

    Return to $string now = mydomain.com/wp-content/uploads/2015/01/name-file-300×215.jpg

    But, i want this size return to (-90×90) = mydomain.com/wp-content/uploads/2015/01/name-file-90×90.jpg

    <?php
    
        //sometime string return this value
        $string = 'mydomain.com/wp-content/uploads/2015/01/name-file-300x215.jpg';
    
        //and sometime string return like this (original size)
        // $string = 'mydomain.com/wp-content/uploads/2015/01/name-file.jpg';
    
        //or sometime string return like this (external image link)
        // $string = 'otherdomain.com/wp-content/uploads/2015/01/name-file.jpg';
    
        //the point now, i want this newstring return like this
        // $string = 'mydomain.com/wp-content/uploads/2015/01/name-file-90x90.jpg';
    
        if(strpos($tring, 'mydomain.com/wp-content/uploads') !== false ){ //check if this string is internal image link
    
        // SO WHAT TO DO BELOW?
        $newstring = ''; // i want this $newstring return this value -> mydomain.com/wp-content/uploads/2015/01/name-file-90x90.jpg
    
        //so i can return this $newstring (new image size 90x90) if string is internal image link
        $return $newstring;
        } else {
    //external image, no need change link parameter
        return $string;
        }
        ?>
  • The topic ‘How to change this internal image link parameter using PHP? i want to resize’ is closed to new replies.