You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+98-56Lines changed: 98 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,16 +45,20 @@ To make things easy for developers, phpZenfolio also provides several of it's ow
45
45
46
46
To use phpZenfolio, all you have to do is include the file in your PHP scripts and create an instance. For example:
47
47
48
-
require_once("phpZenfolio/phpZenfolio.php");
49
-
$f = new phpZenfolio(... arguments go here ...);
48
+
```
49
+
require_once("phpZenfolio/phpZenfolio.php");
50
+
$f = new phpZenfolio(... arguments go here ...);
51
+
```
50
52
51
53
The constructor takes two arguments, one obligatory and one optional:
52
54
53
55
*`AppName` - Required
54
56
55
57
This is the name, version and URL of the application you have built using phpZenfolio. There is no required format, but something like:
56
58
57
-
"My Cool App/1.0 (http://my.url.com)"
59
+
```
60
+
"My Cool App/1.0 (http://my.url.com)"
61
+
```
58
62
59
63
... would be very useful and will allow Zenfolio to identify your application in the event of a problem.
60
64
@@ -65,45 +69,55 @@ The constructor takes two arguments, one obligatory and one optional:
65
69
66
70
As the constructor is a phpZenfolio specific method, it can be instantiated using one of the following methods:
67
71
68
-
Arguments as strings:
72
+
*Arguments as strings:
69
73
70
-
$f = new phpZenfolio("AppName=My Cool App/1.0 (http://app.com)", "APIVer=1.8");
74
+
```
75
+
$f = new phpZenfolio("AppName=My Cool App/1.0 (http://app.com)", "APIVer=1.8");
76
+
```
71
77
72
-
Arguments as an associative array:
78
+
*Arguments as an associative array:
73
79
74
-
$f = new phpZenfolio( array(
75
-
"AppName" => "My Cool App/1.0 (http://app.com)",
76
-
"APIVer" => "1.8")
77
-
);
80
+
```
81
+
$f = new phpZenfolio(array(
82
+
"AppName" => "My Cool App/1.0 (http://app.com)",
83
+
"APIVer" => "1.8")
84
+
);
85
+
```
78
86
79
87
Naturally, you can predefine the array before instantiating the object and just pass the array variable.
80
88
81
89
With the instance instantiated, you can now interact with the Zenfolio API using Zenfolio's native methods exactly as they're documented. Arguments to all Zenfolio native methods must be provided in the order they are documented in the API documentation. For example, use the following to get all recent sets that are of the PhotoSetType 'Gallery':
82
90
83
-
$f->GetRecentSets('Gallery', 0, 3);
91
+
```
92
+
$f->GetRecentSets('Gallery', 0, 3);
93
+
```
84
94
85
95
Note the method's capitalisation and the arguments, these are as they are documented in the [`GetRecentSets()`](http://www.zenfolio.com/zf/help/api/ref/methods/getrecentsets) method documentation.
86
96
87
97
Some of the Zenfolio API methods, like `CreatePhotoSet()`, require an object to be passed as one of the arguments. The object can be passed either as an associative array:
All data returned by the method call is returned as the API documents it with the exception being objects are actually returned as arrays by phpZenfolio. In the event of an error, phpZenfolio will throw one of two exceptions: `PhpZenfolioException` in the event of a problem detected by phpZenfolio or `HttpRequestException` in the event of a problem detected by the code used to communicate with the API. Your application will need to catch these exceptions.
109
123
@@ -118,11 +132,15 @@ phpZenfolio allows you to use the API methods as documented, however to make thi
The Plain-Text method uses HTTPS/SSL for the authentication step to ensure your username and password are encrypted when transmitted to Zenfolio.
128
146
@@ -147,7 +165,9 @@ The `enableCache()` method takes 4 arguments:
147
165
148
166
This a PEAR::MDB2 DSN connection string, for example:
149
167
150
-
mysql://user:password@server/database
168
+
```
169
+
mysql://user:password@server/database
170
+
```
151
171
152
172
phpZenfolio uses the MDB2 PEAR module to interact with the database if you use database based caching. phpZenfolio does *NOT* supply the necessary PEAR modules. If you with to use a database for caching, you will need to download and install PEAR, the MDB2 PEAR module and the corresponding database driver yourself. See [MDB2 Manual](http://pear.php.net/manual/en/package.database.mdb2.intro.php) for details.
153
173
@@ -161,9 +181,11 @@ You may not want to allow the world to view the files that are created during ca
161
181
162
182
In Apache, you can specify this in the configuration files or in a .htaccess file with the following directives:
163
183
164
-
<FilesMatch "\.cache$">
165
-
Deny from all
166
-
</FilesMatch>
184
+
```
185
+
<FilesMatch "\.cache$">
186
+
Deny from all
187
+
</FilesMatch>
188
+
```
167
189
168
190
Alternatively, you can specify a directory that is outside of the web server's document root.
169
191
@@ -183,11 +205,15 @@ Each of the caching methods can be enabled as follows:
If you have caching enabled, and you make changes, it's a good idea to call `clearCache()` to refresh the cache so your changes are reflected immediately.
193
219
@@ -204,19 +230,25 @@ Uploading is very easy. You can either upload an image from your local system u
At this time, the only supported options you can pass at the time of uploading are a `filename` the `modified` parameter which takes a RFC2822 formatted date string...
215
245
216
-
$f->upload("PhotoSetId=123456",
217
-
"File=/path/to/image.jpg",
218
-
"filename=newfilename.jpg",
219
-
"modified=Thu, 14 Jan 2010 13:08:07 +0200");
246
+
```
247
+
$f->upload("PhotoSetId=123456",
248
+
"File=/path/to/image.jpg",
249
+
"filename=newfilename.jpg",
250
+
"modified=Thu, 14 Jan 2010 13:08:07 +0200");
251
+
```
220
252
221
253
If you don't specify a filename, the original filename is used.
222
254
@@ -225,7 +257,9 @@ Uploading is very easy. You can either upload an image from your local system u
225
257
226
258
Uploading to Zenfolio using a URL is done purely by the Zenfolio `CreatePhotoFromUrl()` API method:
You can find full details on the options this method accepts in the [CreatePhotoFromUrl](http://www.zenfolio.com/zf/help/api/ref/methods/createphotofromurl) method documentation.
231
265
@@ -246,8 +280,10 @@ In order to replace a photo, you will need to upload a new photo and then replac
246
280
use of sockets, you can do so using the phpZenfolio supplied
247
281
`setAdapter()` right after instantiating your instance:
248
282
249
-
$f = new phpZenfolio("AppName=<value>");
250
-
$f->setAdapter("socket");
283
+
```
284
+
$f = new phpZenfolio("AppName=<value>");
285
+
$f->setAdapter("socket");
286
+
```
251
287
252
288
Valid arguments are "curl" (default) and "socket".
253
289
@@ -257,32 +293,38 @@ In order to replace a photo, you will need to upload a new photo and then replac
All your calls will then pass through the specified proxy on the specified port.
264
302
265
303
If your proxy server requires a username and password, then add those options to the `setProxy()` method arguments too.
266
304
267
305
For example:
268
306
269
-
$f = new phpZenfolio("AppName=<value>");
270
-
$f->setProxy("server=<proxy_server>",
271
-
"port=<value>",
272
-
"user=<proxy_username>",
273
-
"password=<proxy_password>");
307
+
```
308
+
$f = new phpZenfolio("AppName=<value>");
309
+
$f->setProxy("server=<proxy_server>",
310
+
"port=<value>",
311
+
"user=<proxy_username>",
312
+
"password=<proxy_password>");
313
+
```
274
314
275
315
Note: Proxy support is currently only available when using the default "curl" adapter.
276
316
277
317
* To make it easy to obtain the direct URL to an image, phpZenfolio supplies a `imageURL()` method that takes the Photo object as returned by methods like `LoadPhoto()` and `LoadPhotoSetPhotos()` and an integer for the desired photo size where the integer is one of those documented at http://www.zenfolio.com/zf/help/api/guide/download .
* If phpZenfolio encounters an error, or Zenfolio returns a "failure" response, an exception will be thrown and your application will stop executing. If there is a problem with communicating with the endpoint, a HttpRequestException will be thrown. If an error is detected elsewhere, a PhpZenfolioException will be thrown.
0 commit comments