diff --git a/CHANGELOG.md b/CHANGELOG.md index bc20051..851c229 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,126 +1,139 @@ # Changelog +## html2canvas-php-proxy 1.1.2 + +- Fixed "ternary operator" +- Fixed bugs and code review (1.1.1 version) +- Fixed bug in constants (1.1.0 version) + +## html2canvas-php-proxy 1.0.0 + +- Change constant names +- [Security] Setup allow domains and ports +- Droped support for php4 (and who uses it?) +- This version range (1.0.x) will not receive new features, only fixes, the next version will be available soon. + ## html2canvas-php-proxy 0.2.0 - * Support for html2canvas 0.5 +- Support for html2canvas 0.5 ## html2canvas-php-proxy 0.1.14 - * Fixed bug if CURL is not avaliable +- Fixed bug if CURL is not avaliable ## html2canvas-php-proxy 0.1.13 - * Added support to CURL for improve usage in PHP 5.6 - * Organized functions +- Added support to CURL for improve usage in PHP 5.6 +- Organized functions ## html2canvas-php-proxy 0.1.12 - * Replace 0755 to 0666 permission for backup folder (`images/`) +- Replace 0755 to 0666 permission for backup folder (`images/`) ## html2canvas-php-proxy 0.1.11 - * Now using camelCase in functions - * Fixed extension SVG in saved sources +- Now using camelCase in functions +- Fixed extension SVG in saved sources ## html2canvas-php-proxy 0.1.10 -* Added support to data URI scheme -* Added support to SVG images -* Fixed BUG (Windows servers) with `dirname`, If the script was located in the root folder, the `dirname` function had an invalid character for additional urls generated by this script. -* `json_encode_string` function now has a parameter that removes the quotes from the beginning and end of the string. -* Extra in pullrequest: [pull/10](https://github.com/brcontainer/html2canvas-php-proxy/pull/10) - Thanks to [@jhewes](https://github.com/jhewes) +- Added support to data URI scheme +- Added support to SVG images +- Fixed BUG (Windows servers) with `dirname`, If the script was located in the root folder, the `dirname` function had an invalid character for additional urls generated by this script. +- `json_encode_string` function now has a parameter that removes the quotes from the beginning and end of the string. +- Extra in pullrequest: [pull/10](https://github.com/brcontainer/html2canvas-php-proxy/pull/10) - Thanks to [@jhewes](https://github.com/jhewes) ## html2canvas-php-proxy 0.1.9 -* Added support to "HTTP Basic access authentication" +- Added support to "HTTP Basic access authentication" ## html2canvas-php-proxy 0.1.8 -* Removed unused vars -* Replace tabs by spaces (size 4) -* Added `=== false` misses in `isset()` -* Improved type -* Removed `empty($maxExec)` -* Removed unnecessary `=== true` -* Replace `mkdir(PATH, 755)` to `mkdir(PATH, 0755)` -* Added detect "SSL socket stream" support (If the socket requires "SSL", but do not have suporter then shows an error, but if you do not need to "SSL", even if it is not supported, then the code will work without showing error.) -* Removed `?>` to prevent whitespace. +- Removed unused vars +- Replace tabs by spaces (size 4) +- Added `=== false` misses in `isset()` +- Improved type +- Removed `empty($maxExec)` +- Removed unnecessary `=== true` +- Replace `mkdir(PATH, 755)` to `mkdir(PATH, 0755)` +- Added detect "SSL socket stream" support (If the socket requires "SSL", but do not have suporter then shows an error, but if you do not need to "SSL", even if it is not supported, then the code will work without showing error.) +- Removed `?>` to prevent whitespace. ## html2canvas-php-proxy 0.1.6 and 0.1.7 - 07.05.2014 -* Changed order of functions -* Removed `$e` variable (unused) in `json_encode` -* Fixed line `$response = 'Failed to rename the temporary file';` (`$response` is array) -* Removed incompatibility with PHP old versions (before 5.1.0) in `relative2absolute` -* Added returns "blank" in `relative2absolute` (if `scheme` invalid in `$m` parameter) -* Added detect problem in redirects (if you have multiple redirects) -* Replace `stripos` by `strpos` (php4) - version 0.1.7 -* Added comparison of "socket time limit (timeout)" and "max_execution_time" (php.ini), preventing the page goes blank - version 0.1.7 -* Fixed urls like `//website.com/path/../file.png` to `http://website.com/file.png` +- Changed order of functions +- Removed `$e` variable (unused) in `json_encode` +- Fixed line `$response = 'Failed to rename the temporary file';` (`$response` is array) +- Removed incompatibility with PHP old versions (before 5.1.0) in `relative2absolute` +- Added returns "blank" in `relative2absolute` (if `scheme` invalid in `$m` parameter) +- Added detect problem in redirects (if you have multiple redirects) +- Replace `stripos` by `strpos` (php4) - version 0.1.7 +- Added comparison of "socket time limit (timeout)" and "max_execution_time" (php.ini), preventing the page goes blank - version 0.1.7 +- Fixed urls like `//website.com/path/../file.png` to `http://website.com/file.png` ## html2canvas-php-proxy 0.1.5 - 04.05.2014 -* Improved "typing" for better updates/pull-request -* Converted various variables to (int) -* Removed must-revalidate in header -* Improved forks -* Improved http response, If http_status<>200, return error in html2canvas -* Fixed bug in Facebook redirect (HTTP/1.1 302 forced.302) -* Removed unnecessary Etag-header -* Fixed undefined variables -* Fixed bug in `json_encode_string` (characters) -* Fixed "invalid escapes" in `json_encode_string` -* Improved performance in `json_encode_string` -* Removed `utf8_encode` (unnecessary) in `json_encode_string` -* Fixed bug in `relative2absolute` -* `downloadSource` always returns array -* Replace `error_get_last` by `get_error` -* Added comments in functions +- Improved "typing" for better updates/pull-request +- Converted various variables to (int) +- Removed must-revalidate in header +- Improved forks +- Improved http response, If http_status<>200, return error in html2canvas +- Fixed bug in Facebook redirect (HTTP/1.1 302 forced.302) +- Removed unnecessary Etag-header +- Fixed undefined variables +- Fixed bug in `json_encode_string` (characters) +- Fixed "invalid escapes" in `json_encode_string` +- Improved performance in `json_encode_string` +- Removed `utf8_encode` (unnecessary) in `json_encode_string` +- Fixed bug in `relative2absolute` +- `downloadSource` always returns array +- Replace `error_get_last` by `get_error` +- Added comments in functions ## html2canvas-php-proxy 0.1.2 to 0.1.4 - 17.03.2014 -* Added support to javascript functions based in Objects (update to 0.1.2) -* Fixed bug in 0.1.2 (update to 0.1.3) -* Added support to "relative paths" (function relative2absolute) (0.1.4) -* Added "referrer header" (if exists) (0.1.4) -* Added "remove charset" for mime-types (eg. text/html; charset=ut8 => text/html) (0.1.4) -* Added prefix in files created by html2canvas-php-proxy (0.1.4) -* "remove_old_files function" removes only the files with prefix (0.1.4) +- Added support to javascript functions based in Objects (update to 0.1.2) +- Fixed bug in 0.1.2 (update to 0.1.3) +- Added support to "relative paths" (function relative2absolute) (0.1.4) +- Added "referrer header" (if exists) (0.1.4) +- Added "remove charset" for mime-types (eg. text/html; charset=ut8 => text/html) (0.1.4) +- Added prefix in files created by html2canvas-php-proxy (0.1.4) +- "remove_old_files function" removes only the files with prefix (0.1.4) ## html2canvas-php-proxy 0.1.1 - 01.12.2013 -* Support for PHP 4.3 -* Replace `isset($vector['var']{0})` by `isset($vector['var']) && strlen($vector['var'])>0` to prevent the error `Uninitialized string offset: 0` -* `MAX_EXEC` may not be less than 15 seconds -* Add support to bitmap files -* If the parameter "callback" has invalid characters then sets the variable `$param_callback` with `JSLOG`; -* Detects if the "host:" header was set by the client -* Remove port from `$_SERVER['HTTP_HOST']` to prevent problem in the formatting of the address -* Add function for remove old files -* Fixed "validate" callback param +- Support for PHP 4.3 +- Replace `isset($vector['var']{0})` by `isset($vector['var']) && strlen($vector['var'])>0` to prevent the error `Uninitialized string offset: 0` +- `MAX_EXEC` may not be less than 15 seconds +- Add support to bitmap files +- If the parameter "callback" has invalid characters then sets the variable `$param_callback` with `JSLOG`; +- Detects if the "host:" header was set by the client +- Remove port from `$_SERVER['HTTP_HOST']` to prevent problem in the formatting of the address +- Add function for remove old files +- Fixed "validate" callback param ## html2canvas-php-proxy 0.1.0 - 24.11.2013 -* Script completely rewritten -* Added detection list "Content-length:" header -* Added alternative to callback parameter (eg. The function call is `console.log` or `alert()`, if there is no callback parameter) -* Added support for detecting max_execution_time -* Added the use of `erro_get_last()` -* Added support for "Location:" header -* Added support for detecting 304 HTTP, return an error warning (socket does not use/send Etags) -* Added `utf8_encode` to `json_encode` to prevent the error string becomes NULL -* Added an error warning, if there is no the file "Content-type:" header -* In case of HTTP 3xx response, if there is no "Location:" header, returns an error warning -* Improved response headers from proxy (`function setHeaders`) -* Improved validation http/https (`function isHttpUrl`) -* Prevent warning in `rename()` (PHP 5.2 in CGI), because the warning `return false;` -* In addition to other improvements when the script was rewritten +- Script completely rewritten +- Added detection list "Content-length:" header +- Added alternative to callback parameter (eg. The function call is `console.log` or `alert()`, if there is no callback parameter) +- Added support for detecting max_execution_time +- Added the use of `erro_get_last()` +- Added support for "Location:" header +- Added support for detecting 304 HTTP, return an error warning (socket does not use/send Etags) +- Added `utf8_encode` to `json_encode` to prevent the error string becomes NULL +- Added an error warning, if there is no the file "Content-type:" header +- In case of HTTP 3xx response, if there is no "Location:" header, returns an error warning +- Improved response headers from proxy (`function setHeaders`) +- Improved validation http/https (`function isHttpUrl`) +- Prevent warning in `rename()` (PHP 5.2 in CGI), because the warning `return false;` +- In addition to other improvements when the script was rewritten ## html2canvas-php-proxy 0.0.4 - 20.11.2013 -* Fixed tmp fileName $locationFile.$token -* Use complete URI scheme for https +- Fixed tmp fileName $locationFile.$token +- Use complete URI scheme for https diff --git a/README.html b/README.html index 8e8fbdd..c42700d 100644 --- a/README.html +++ b/README.html @@ -1,4 +1,4 @@ -README

html2canvas-php-proxy 1.0.0

+README

html2canvas-php-proxy

PHP Proxy html2canvas

This script allows you to use html2canvas.js with different servers, ports and protocols (http, https), preventing to occur “tainted” when exporting the <canvas> for image.

@@ -1139,12 +1139,12 @@

Setup Set false for disable SSL checking or true for enable (require config PHP.INI with curl.cainfo=/path/to/cacert.pem). You can set path manualy like this: define('H2CP_SSL_VERIFY_PEER', '/path/to/cacert.pem'); -define('H2CP_ALLOWED_DOMAINS', array( '*' )); -* allow all domains, for subdomains use like this *.site.com, for fixed domains use array( 'site.com', 'www.site.com' ) +define('H2CP_ALLOWED_DOMAINS', '*'); +* allow all domains, for subdomains use like this *.site.com, for fixed domains use , 'site.com,www.site.com' (string separed by commas) -define('H2CP_ALLOWED_PORTS', array( 80, 443 )); -Config allowed ports +define('H2CP_ALLOWED_PORTS', '80,443'); +Config allowed ports (string separed by commas) @@ -1201,12 +1201,12 @@

Usage

Using Web Console

If you have any problems with the script recommend to analyze the log use the Web Console from your browser: - Firefox: https://developer.mozilla.org/en-US/docs/Tools/Browser_Console - Chrome: https://developers.google.com/chrome-developer-tools/docs/console +* Firefox: https://developer.mozilla.org/en-US/docs/Tools/Browser_Console +* Chrome: https://developers.google.com/chrome-developer-tools/docs/console * InternetExplorer: http://msdn.microsoft.com/en-us/library/gg589530%28v=vs.85%29.aspx

Get NetWork results: - Firefox: https://hacks.mozilla.org/2013/05/firefox-developer-tool-features-for-firefox-23/ - Chrome: https://developers.google.com/chrome-developer-tools/docs/network +* Firefox: https://hacks.mozilla.org/2013/05/firefox-developer-tool-features-for-firefox-23/ +* Chrome: https://developers.google.com/chrome-developer-tools/docs/network * InternetExplorer: http://msdn.microsoft.com/en-us/library/gg130952%28v=vs.85%29.aspx

An alternative is to diagnose problems accessing the link directly:

http://[DOMAIN]/[PATH]/html2canvasproxy.php?url=http%3A%2F%2Fmaps.googleapis.com%2Fmaps%2Fapi%2Fstaticmap%3Fcenter%3D40.714728%2C-73.998672%26zoom%3D12%26size%3D800x600%26maptype%3Droadmap%26sensor%3Dfalse%261&callback=html2canvas_0

diff --git a/README.md b/README.md index c6e87be..7b68138 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## html2canvas-php-proxy 1.0.0 +## html2canvas-php-proxy ## PHP Proxy html2canvas diff --git a/examples/google-maps-static.html b/examples/google-maps-static.html index 13b40ec..a1d3fb4 100644 --- a/examples/google-maps-static.html +++ b/examples/google-maps-static.html @@ -1,72 +1,101 @@ - - - Google Maps static and html2canvas - + + - - - -

Google Maps static and html2canvas

-

Tested on Chrome and Firefox

-

- REQUIRES API KEY, - obtain in: https://developers.google.com/maps/documentation/javascript/get-api-key -

+ }; + + + +

Google Maps static and html2canvas

-
-

Maps example:

-
- -
-
- - -
-
+

Tested on Chrome and Firefox

+ +

+ Note: for use this example you needs replace YOUR_API_KEY in <img> by your "api key" from "google dev", for obtain a "api key" access: https://developers.google.com/maps/documentation/javascript/get-api-key +

-
-

Output results:

+
+

Maps example:

+
+
- +
+ + +
+
+ +
+

Output results:

+
+ diff --git a/examples/google-maps.html b/examples/google-maps.html index 753f6ae..05f2d53 100644 --- a/examples/google-maps.html +++ b/examples/google-maps.html @@ -3,12 +3,32 @@ Google Maps and html2canvas + + @@ -48,12 +68,23 @@ "proxy": "../html2canvasproxy.php", "logging": true, //Enable log (use Web Console for get Errors and Warnings) "onrendered": function(canvas) { - var img = new Image(); - img.onload = function () { - img.onload = null; - document.getElementById("output").appendChild(img); - }; - img.src = canvas.toDataURL("image/png"); + var img = new Image; + + img.onload = function () { + img.onload = null; + document.getElementById("output").appendChild(img); + }; + + img.onerror = function() { + img.onerror = null; + if(window.console.log) { + window.console.log("Not loaded image from canvas.toDataURL"); + } else { + alert("Not loaded image from canvas.toDataURL"); + } + }; + + img.src = canvas.toDataURL("image/png"); } }); } @@ -68,25 +99,26 @@ }; - -

Google Maps with html2canvas

-

Tested on Chrome and Firefox

-

- REQUIRES API KEY, - obtain in: https://developers.google.com/maps/documentation/javascript/get-api-key -

- -
-

Maps example:

-
-
- - -
-
+ +

Google Maps with html2canvas

-
-

Output results:

+

Tested on Chrome and Firefox

+ +

+ Note: for use this example you needs replace YOUR_API_KEY in <img> by your "api key" from "google dev", for obtain a "api key" access: https://developers.google.com/maps/documentation/javascript/get-api-key +

+ +
+

Maps example:

+
+
+ +
- +
+ +
+

Output results:

+
+ diff --git a/examples/html2canvas-0.4.1.html b/examples/html2canvas-0.4.1.html index f65adbe..d31df2e 100644 --- a/examples/html2canvas-0.4.1.html +++ b/examples/html2canvas-0.4.1.html @@ -1,47 +1,48 @@ - - - html2canvas 0.4.1 with PHP proxy - + - - -

html2canvas 0.4.1 with PHP proxy

+ }; + + img.src = canvas.toDataURL("image/png"); + } + }); + }; + + + +

html2canvas 0.4.1 with PHP proxy

-

- From githubusercontent.com:
- google maps static -

-

- From facebook.com (with http redirect):
- facebook image redirect -

- +

+ From githubusercontent.com:
+ google maps static +

+

+ From facebook.com (with http redirect):
+ facebook image redirect +

+ diff --git a/examples/html2canvas-0.5.html b/examples/html2canvas-0.5.html index d875255..e8ea0bf 100644 --- a/examples/html2canvas-0.5.html +++ b/examples/html2canvas-0.5.html @@ -1,50 +1,47 @@ - - - html2canvas 0.5 with PHP proxy - - + - - -

html2canvas 0.5 with PHP proxy

-

- From githubusercontent.com:
- google maps static -

-

- From facebook.com (with http redirect):
- facebook image redirect -

- + img.src = canvas.toDataURL("image/png"); + }); + }; + + + +

html2canvas 0.5 with PHP proxy

+ +

+ From githubusercontent.com:
+ google maps static +

+

+ From facebook.com (with http redirect):
+ facebook image redirect +

+ diff --git a/html2canvasproxy.php b/html2canvasproxy.php index 92d803f..65ab446 100644 --- a/html2canvasproxy.php +++ b/html2canvasproxy.php @@ -1,6 +1,6 @@