Advertisement
Guest User

Check Image exists

a guest
Mar 17th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. The code you write work perfectly for this
  2.  
  3. http://example.com/images/200x180
  4.  
  5. If user pass only width, I have to assume that it is squre like this
  6. http://example.com/images/200 means http://example.com/images/200x200
  7.  
  8. And I try to modify your htaccess code
  9.  
  10.     # request URL is for images
  11.     RewriteCond %{REQUEST_URI}  ^/images/([^x]+)x([^/]+)/? [NC]
  12.     # disable storage loops
  13.     RewriteCond %{REQUEST_URI}  !storage [NC]
  14.     # check for file exists
  15.     RewriteCond %{REQUEST_URI} -f
  16.     RewriteRule .*   /storage/%1/%1x%2.png [L][OR]
  17.     RewriteRule .*   /storage/%1/%1x%1.png [L]
  18.    
  19. Is this correct?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement