Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <?php
  2.  
  3. //sometime string return this value
  4. $string = 'mydomain.com/wp-content/uploads/2015/01/name-file-300x215.jpg';
  5.  
  6. //and sometime string return like this (original size)
  7. // $string = 'mydomain.com/wp-content/uploads/2015/01/name-file.jpg';
  8.  
  9. //or sometime string return like this (external image link)
  10. // $string = 'otherdomain.com/wp-content/uploads/2015/01/name-file.jpg';
  11.  
  12. //the point now, i want this newstring return like this
  13. // $string = 'mydomain.com/wp-content/uploads/2015/01/name-file-90x90.jpg';
  14.  
  15. if(strpos($tring, 'mydomain.com/wp-content/uploads') !== false ){ //check if this string is internal image link
  16.  
  17. // SO WHAT TO DO BELOW?
  18. $newstring = ''; // i want this $newstring return this value -> mydomain.com/wp-content/uploads/2015/01/name-file-90x90.jpg
  19.  
  20. //so i can $newstring (new image size 90x90) if string return internal image link
  21. $return $newstring;
  22. } else {
  23. return $string;
  24. }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement