Re321 Posted April 21, 2010 Share Posted April 21, 2010 hello, I have an image generator basically, to create an image based on data. what I need to do is parse roughly 12 entries (not too long) and generate an image out of them. since it's an image I need to send it to another php form through $_GET data (as <img> uses an external resource, I can't pass it through $_POST) but im not sure what is the best way. urlencode I think works, but it may be too long for the GET url, what do you think is the best method? - urlencode - base64_encode - serialize -... just to encode the 12 (5-30 in length each) POST entries so I can use them, I just am not sure what is a good solution to pass those values to the other php page o_O; Thanks Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted April 21, 2010 Share Posted April 21, 2010 if urlencode works, then use that. base64_encode() and serialize are just ways of masking values (not their real use, but in this case, that's all they'd be doing really), so using them is not going to change anything, execpt make the string longer. however, you shouldn't worry about the length of a URL as modern day browsers are capable of accepting thousands of characters/bytes in a URL string. EDIT: are the entries in an array? i'm not following that aspect of the equation. Quote Link to comment Share on other sites More sharing options...
Re321 Posted April 21, 2010 Author Share Posted April 21, 2010 if urlencode works, then use that. base64_encode() and serialize are just ways of masking values (not their real use, but in this case, that's all they'd be doing really), so using them is not going to change anything, execpt make the string longer. however, you shouldn't worry about the length of a URL as modern day browsers are capable of accepting thousands of characters/bytes in a URL string. EDIT: are the entries in an array? i'm not following that aspect of the equation. Sorry. I am passing the $_POST array completely, the $_POST array has roughly 12 indexes which are 5-30 characters or so, since I need to pass it through url I was wondering what method produced the shortest string to pass through $_GET. (like generator.php?data= (the data)) Quote Link to comment Share on other sites More sharing options...
Re321 Posted April 21, 2010 Author Share Posted April 21, 2010 Sorry for the confusion! I tested 4-5 things.. In case anyone is wondering, With 14 POST entries the same length: json_encode on $_POST was roughly 182 characters url_encode on json_encode was ~300 characters serialize on $_POST was roughly 280 characters base64_encode on serialize was ~320 characters base64_encode on json_encode ~ 244 characters So B64 on json_encode will work best for the $_GET url for me, no url encoding and it solves my problem. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.