You are viewing our Forum Archives. To view or take place in current topics click here.
PHP/HTML - URL Help
Posted:
PHP/HTML - URL HelpPosted:
Status: Offline
Joined: Jan 16, 201212Year Member
Posts: 20,271
Reputation Power: 17066
Motto: 2b || !2b
Motto: 2b || !2b
Status: Offline
Joined: Jan 16, 201212Year Member
Posts: 20,271
Reputation Power: 17066
Motto: 2b || !2b
So, I'm a little stuck on what to do and hope some of the clever folks around here can solve my issue.
I have setup a simple page to display all the images that use a .jpg extension in a certain directory, which works fine for my needs apart from one thing. I cannot seem to get my head around how to implement a URL encode/decode for the symbols (i.e # \ / and spaces).
How would I go about implementing some sort of URL encode that is automatic, in the code below.
Thanks.
Sorry for Pastebin link but can't post PHP on forums.
[ Register or Signin to view external links. ]
I have setup a simple page to display all the images that use a .jpg extension in a certain directory, which works fine for my needs apart from one thing. I cannot seem to get my head around how to implement a URL encode/decode for the symbols (i.e # \ / and spaces).
How would I go about implementing some sort of URL encode that is automatic, in the code below.
Thanks.
Sorry for Pastebin link but can't post PHP on forums.
[ Register or Signin to view external links. ]
#2. Posted:
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
#3. Posted:
Status: Offline
Joined: Jan 16, 201212Year Member
Posts: 20,271
Reputation Power: 17066
Motto: 2b || !2b
Motto: 2b || !2b
Status: Offline
Joined: Jan 16, 201212Year Member
Posts: 20,271
Reputation Power: 17066
Motto: 2b || !2b
I don't really understand it myself, but I'll try to explain as best I can.
I have a image file in a directory that I would like to display on a web page, which works fine for files that have the regular names. But when it comes to files with # or < > in the name, it fails to display.
htmlEntities sounds like what I need or PHP String Replace, not sure which would be better.
EDIT:
[ Register or Signin to view external links. ]
I have a image file in a directory that I would like to display on a web page, which works fine for files that have the regular names. But when it comes to files with # or < > in the name, it fails to display.
htmlEntities sounds like what I need or PHP String Replace, not sure which would be better.
EDIT:
[ Register or Signin to view external links. ]
- 0useful
- 0not useful
#4. Posted:
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
Are you unable to rename your images?
- 0useful
- 0not useful
#5. Posted:
Status: Offline
Joined: May 16, 201311Year Member
Posts: 8,525
Reputation Power: 1554
Status: Offline
Joined: May 16, 201311Year Member
Posts: 8,525
Reputation Power: 1554
I'm barely educated on PHP, but wouldn't this be PHP String Replace of some sorts? If I were you I would just change the image's file name and go from there because it's a much easier solution than practically almost rebuilding
- 0useful
- 0not useful
#6. Posted:
Status: Offline
Joined: Jan 16, 201212Year Member
Posts: 20,271
Reputation Power: 17066
Motto: 2b || !2b
Motto: 2b || !2b
Status: Offline
Joined: Jan 16, 201212Year Member
Posts: 20,271
Reputation Power: 17066
Motto: 2b || !2b
-Deano wrote Are you unable to rename your images?I am yes, but since new images are added very frequently under pre made names, renaming them is out of the options list for this use case.
I think I'm missing a small bit of code to automatically convert # to %23 which in turn, works perfectly.
- 0useful
- 0not useful
#7. Posted:
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
#8. Posted:
Status: Offline
Joined: Feb 25, 20168Year Member
Posts: 19
Reputation Power: 13
Status: Offline
Joined: Feb 25, 20168Year Member
Posts: 19
Reputation Power: 13
Craig wrote-Deano wrote Are you unable to rename your images?I am yes, but since new images are added very frequently under pre made names, renaming them is out of the options list for this use case.
I think I'm missing a small bit of code to automatically convert # to %23 which in turn, works perfectly.
uhhh
urlencode()
urldecode()
[ Register or Signin to view external links. ]
no need for FANCY shit like -deano want u to use
- 0useful
- 1not useful
#9. Posted:
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
lamronsavage wrote
uhhh
urlencode()
urldecode()
[ Register or Signin to view external links. ]
no need for FANCY shit like -deano want u to use
I mean, I suggested rawurlencode() and you think that's fancy shit?
It's literally the same as what you are suggesting, except spaces are also converted to %20 instead of a +...
- 0useful
- 0not useful
#10. Posted:
Status: Offline
Joined: Jan 16, 201212Year Member
Posts: 20,271
Reputation Power: 17066
Motto: 2b || !2b
Motto: 2b || !2b
Status: Offline
Joined: Jan 16, 201212Year Member
Posts: 20,271
Reputation Power: 17066
Motto: 2b || !2b
Either one I wouldn't mind, but how the hell i integrate it with the code above, is still beyond me xD
- 0useful
- 0not useful
You are viewing our Forum Archives. To view or take place in current topics click here.