Gallery Bank: WordPress Photo Gallery Plugin - Version 1.8.5

Version Description

Download this release

Release Info

Developer Gallery-Bank
Plugin Icon 128x128 Gallery Bank: WordPress Photo Gallery Plugin
Version 1.8.5
Comparing to
See all releases

Code changes from version 1.8.4 to 1.8.5

gallery-bank.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin URI: http://gallery-bank.com
5
  Description: Gallery Bank is an interactive WordPress photo gallery plugin, best fit for creative and corporate portfolio websites.
6
  Author: Gallery-Bank
7
- Version: 1.8.4
8
  Author URI: http://gallery-bank.com
9
  */
10
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -38,7 +38,5 @@ function plugin_load_textdomain()
38
  }
39
  }
40
  add_action('plugins_loaded', 'plugin_load_textdomain');
41
-
42
  register_activation_hook(__FILE__,'plugin_install_script_for_gallery_bank');
43
-
44
  ?>
4
  Plugin URI: http://gallery-bank.com
5
  Description: Gallery Bank is an interactive WordPress photo gallery plugin, best fit for creative and corporate portfolio websites.
6
  Author: Gallery-Bank
7
+ Version: 1.8.5
8
  Author URI: http://gallery-bank.com
9
  */
10
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
38
  }
39
  }
40
  add_action('plugins_loaded', 'plugin_load_textdomain');
 
41
  register_activation_hook(__FILE__,'plugin_install_script_for_gallery_bank');
 
42
  ?>
lib/class.jpeg_icc.php ADDED
@@ -0,0 +1,566 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * PHP JPEG ICC profile manipulator class
4
+ *
5
+ * @author Richard Toth aka risko (risko@risko.org)
6
+ * @version 0.1
7
+ */
8
+ class JPEG_ICC
9
+ {
10
+ /**
11
+ * ICC header size in APP2 segment
12
+ *
13
+ * 'ICC_PROFILE' 0x00 chunk_no chunk_cnt
14
+ */
15
+ const ICC_HEADER_LEN = 14;
16
+
17
+ /**
18
+ * maximum data len of a JPEG marker
19
+ */
20
+ const MAX_BYTES_IN_MARKER = 65533;
21
+
22
+ /**
23
+ * ICC header marker
24
+ */
25
+ const ICC_MARKER = "ICC_PROFILE\x00";
26
+
27
+ /**
28
+ * Rendering intent field (Bytes 64 to 67 in ICC profile data)
29
+ */
30
+ const ICC_RI_PERCEPTUAL = 0x00000000;
31
+ const ICC_RI_RELATIVE_COLORIMETRIC = 0x00000001;
32
+ const ICC_RI_SATURATION = 0x00000002;
33
+ const ICC_RI_ABSOLUTE_COLORIMETRIC = 0x00000003;
34
+
35
+ /**
36
+ * ICC profile data
37
+ * @var string
38
+ */
39
+ private $icc_profile = '';
40
+
41
+ /**
42
+ * ICC profile data size
43
+ * @var int
44
+ */
45
+ private $icc_size = 0;
46
+ /**
47
+ * ICC profile data chunks count
48
+ * @var int
49
+ */
50
+ private $icc_chunks = 0;
51
+
52
+
53
+ /**
54
+ * Class contructor
55
+ */
56
+ public function __construct()
57
+ {
58
+ }
59
+
60
+ /**
61
+ * Load ICC profile from JPEG file.
62
+ *
63
+ * Returns true if profile successfully loaded, false otherwise.
64
+ *
65
+ * @param string file name
66
+ * @return bool
67
+ */
68
+ public function LoadFromJPEG($fname)
69
+ {
70
+ $f = file_get_contents($fname);
71
+ $len = strlen($f);
72
+ $pos = 0;
73
+ $counter = 0;
74
+ $profile_chunks = array(); // tu su ulozene jednotlive casti profilu
75
+
76
+ while ($pos < $len && $counter < 1000)
77
+ {
78
+ $pos = strpos($f, "\xff", $pos);
79
+ if ($pos === false) break; // dalsie 0xFF sa uz nenaslo - koniec vyhladavania
80
+
81
+ $type = $this->getJPEGSegmentType($f, $pos);
82
+ switch ($type)
83
+ {
84
+ case 0xe2: // APP2
85
+ //echo "APP2 ";
86
+ $size = $this->getJPEGSegmentSize($f, $pos);
87
+ //echo "Size: $size\n";
88
+
89
+ if ($this->getJPEGSegmentContainsICC($f, $pos, $size))
90
+ {
91
+ //echo "+ ICC Profile: YES\n";
92
+ list($chunk_no, $chunk_cnt) = $this->getJPEGSegmentICCChunkInfo($f, $pos);
93
+ //echo "+ ICC Profile chunk number: $chunk_no\n";
94
+ //echo "+ ICC Profile chunks count: $chunk_cnt\n";
95
+
96
+ if ($chunk_no <= $chunk_cnt)
97
+ {
98
+ $profile_chunks[$chunk_no] = $this->getJPEGSegmentICCChunk($f, $pos);
99
+
100
+ if ($chunk_no == $chunk_cnt) // posledny kusok
101
+ {
102
+ ksort($profile_chunks);
103
+ $this->SetProfile(implode('', $profile_chunks));
104
+ return true;
105
+ }
106
+ }
107
+ }
108
+ $pos += $size + 2; // size of segment data + 2B size of segment marker
109
+ break;
110
+
111
+ case 0xe0: // APP0
112
+ case 0xe1: // APP1
113
+ case 0xe3: // APP3
114
+ case 0xe4: // APP4
115
+ case 0xe5: // APP5
116
+ case 0xe6: // APP6
117
+ case 0xe7: // APP7
118
+ case 0xe8: // APP8
119
+ case 0xe9: // APP9
120
+ case 0xea: // APP10
121
+ case 0xeb: // APP11
122
+ case 0xec: // APP12
123
+ case 0xed: // APP13
124
+ case 0xee: // APP14
125
+ case 0xef: // APP15
126
+ case 0xc0: // SOF0
127
+ case 0xc2: // SOF2
128
+ case 0xc4: // DHT
129
+ case 0xdb: // DQT
130
+ case 0xda: // SOS
131
+ case 0xfe: // COM
132
+ $size = $this->getJPEGSegmentSize($f, $pos);
133
+ $pos += $size + 2; // size of segment data + 2B size of segment marker
134
+ break;
135
+
136
+ case 0xd8: // SOI
137
+ case 0xdd: // DRI
138
+ case 0xd9: // EOI
139
+ case 0xd0: // RST0
140
+ case 0xd1: // RST1
141
+ case 0xd2: // RST2
142
+ case 0xd3: // RST3
143
+ case 0xd4: // RST4
144
+ case 0xd5: // RST5
145
+ case 0xd6: // RST6
146
+ case 0xd7: // RST7
147
+ default:
148
+ $pos += 2;
149
+ break;
150
+ }
151
+ $counter++;
152
+ }
153
+
154
+ return false;
155
+ }
156
+
157
+ public function SaveToJPEG($fname)
158
+ {
159
+ if ($this->icc_profile == '') throw new Exception("No profile loaded.\n");
160
+
161
+ if (!file_exists($fname)) throw new Exception("File $fname doesn't exist.\n");
162
+ if (!is_readable($fname)) throw new Exception("File $fname isn't readable.\n");
163
+ $dir = realpath($fname);
164
+ if (!is_writable($dir)) throw new Exception("Directory $fname isn't writeable.\n");
165
+
166
+ $f = file_get_contents($fname);
167
+ if ($this->insertProfile($f))
168
+ {
169
+ $fsize = strlen($f);
170
+ $ret = file_put_contents($fname, $f);
171
+ if ($ret === false || $ret < $fsize) throw new Exception ("Write failed.\n");
172
+ }
173
+ }
174
+
175
+ /**
176
+ * Load profile from ICC file.
177
+ *
178
+ * @param string file name
179
+ */
180
+ public function LoadFromICC($fname)
181
+ {
182
+ if (!file_exists($fname)) throw new Exception("File $fname doesn't exist.\n");
183
+ if (!is_readable($fname)) throw new Exception("File $fname isn't readable.\n");
184
+
185
+ $this->SetProfile(file_get_contents($fname));
186
+ }
187
+
188
+ /**
189
+ * Save profile to ICC file.
190
+ *
191
+ * @param string file name
192
+ * @param bool [force overwrite]
193
+ */
194
+ public function SaveToICC($fname, $force_overwrite = false)
195
+ {
196
+ if ($this->icc_profile == '') throw new Exception("No profile loaded.\n");
197
+ $dir = realpath($fname);
198
+ if (!is_writable($dir)) throw new Exception("Directory $fname isn't writeable.\n");
199
+ if (!$force_overwrite && file_exists($fname)) throw new Exception("File $fname exists.\n");
200
+
201
+ $ret = file_put_contents($fname, $this->icc_profile);
202
+ if ($ret === false || $ret < $this->icc_size) throw new Exception ("Write failed.\n");
203
+ }
204
+
205
+ /**
206
+ * Remove profile from JPEG file and save it as a new file.
207
+ * Overwriting destination file can be forced
208
+ *
209
+ * @param string source file
210
+ * @param string destination file
211
+ * @param bool [force overwrite]
212
+ * @return bool
213
+ */
214
+ public function RemoveFromJPEG($input, $output, $force_overwrite = false)
215
+ {
216
+ if (!file_exists($input)) throw new Exception("File $input doesn't exist.\n");
217
+ if (!is_readable($input)) throw new Exception("File $input isn't readable.\n");
218
+ $dir = realpath($output);
219
+ if (!is_writable($dir)) throw new Exception("Directory $output isn't writeable.\n");
220
+ if (!$force_overwrite && file_exists($output)) throw new Exception("File $output exists.\n");
221
+
222
+ $f = file_get_contents($input);
223
+ $this->removeProfile($f);
224
+ $fsize = strlen($f);
225
+ $ret = file_put_contents($output, $f);
226
+ if ($ret === false || $ret < $fsize) throw new Exception ("Write failed.\n");
227
+
228
+ return true; // any other error throws exception
229
+ }
230
+
231
+ /**
232
+ * Set profile directly
233
+ *
234
+ * @param string profile data
235
+ */
236
+ public function SetProfile($data)
237
+ {
238
+ $this->icc_profile = $data;
239
+ $this->icc_size = strlen($data);
240
+ $this->countChunks();
241
+ }
242
+
243
+ /**
244
+ * Get profile directly
245
+ *
246
+ * @return string
247
+ */
248
+ public function GetProfile()
249
+ {
250
+ return $this->icc_profile;
251
+ }
252
+
253
+ /**
254
+ * Count in how many chunks we need to divide the profile to store it in JPEG APP2 segments
255
+ */
256
+ private function countChunks()
257
+ {
258
+ $this->icc_chunks = ceil($this->icc_size / ((float) (self::MAX_BYTES_IN_MARKER - self::ICC_HEADER_LEN)));
259
+ }
260
+
261
+ /**
262
+ * Set Rendering Intent of the profile.
263
+ *
264
+ * Possilbe values are ICC_RI_PERCEPTUAL, ICC_RI_RELATIVE_COLORIMETRIC, ICC_RI_SATURATION or ICC_RI_ABSOLUTE_COLORIMETRIC.
265
+ *
266
+ * @param int rendering intent
267
+ */
268
+ private function setRenderingIntent($newRI)
269
+ {
270
+ if ($this->icc_size >= 68)
271
+ {
272
+ substr_replace($this->icc_profile, pack('N', $newRI), 64, 4);
273
+ }
274
+ }
275
+
276
+ /**
277
+ * Get value of Rendering Intent field in ICC profile
278
+ *
279
+ * @return int
280
+ */
281
+ private function getRenderingIntent()
282
+ {
283
+ if ($this->icc_size >= 68)
284
+ {
285
+ $arr = unpack('Nint', substr($this->icc_profile, 64, 4));
286
+ return $arr['int'];
287
+ }
288
+
289
+ return null;
290
+ }
291
+
292
+ /**
293
+ * Size of JPEG segment
294
+ *
295
+ * @param string file data
296
+ * @param int start of segment
297
+ * @return int
298
+ */
299
+ private function getJPEGSegmentSize(&$f, $pos)
300
+ {
301
+ $arr = unpack('nint', substr($f, $pos + 2, 2)); // segment size has offset 2 and length 2B
302
+ return $arr['int'];
303
+ }
304
+
305
+ /**
306
+ * Type of JPEG segment
307
+ *
308
+ * @param string file data
309
+ * @param int start of segment
310
+ * @return int
311
+ */
312
+ private function getJPEGSegmentType(&$f, $pos)
313
+ {
314
+ $arr = unpack('Cchar', substr($f, $pos + 1, 1)); // segment type has offset 1 and length 1B
315
+ return $arr['char'];
316
+ }
317
+
318
+ /**
319
+ * Check if segment contains ICC profile marker
320
+ *
321
+ * @param string file data
322
+ * @param int position of segment data
323
+ * @param int size of segment data (without 2 bytes of size field)
324
+ * @return bool
325
+ */
326
+ private function getJPEGSegmentContainsICC(&$f, $pos, $size)
327
+ {
328
+ if ($size < self::ICC_HEADER_LEN) return false; // ICC_PROFILE 0x00 Marker_no Marker_cnt
329
+
330
+ return (bool) (substr($f, $pos + 4, self::ICC_HEADER_LEN - 2) == self::ICC_MARKER); // 4B offset in segment data = 2B segment marker + 2B segment size data
331
+ }
332
+
333
+ /**
334
+ * Get ICC segment chunk info
335
+ *
336
+ * @param string file data
337
+ * @param int position of segment data
338
+ * @return array {chunk_no, chunk_cnt}
339
+ */
340
+ private function getJPEGSegmentICCChunkInfo(&$f, $pos)
341
+ {
342
+ $a = unpack('Cchunk_no/Cchunk_count', substr($f, $pos + 16, 2)); // 16B offset to data = 2B segment marker + 2B segment size + 'ICC_PROFILE' + 0x00, 1. byte chunk number, 2. byte chunks count
343
+ return array_values($a);
344
+ }
345
+
346
+ /**
347
+ * Returns chunk of ICC profile data from segment.
348
+ *
349
+ * @param string &data
350
+ * @param int current position
351
+ * @return string
352
+ */
353
+ private function getJPEGSegmentICCChunk(&$f, $pos)
354
+ {
355
+ $data_offset = $pos + 4 + self::ICC_HEADER_LEN; // 4B JPEG APP offset + 14B ICC header offset
356
+ $size = $this->getJPEGSegmentSize($f, $pos);
357
+ $data_size = $size - self::ICC_HEADER_LEN - 2; // 14B ICC header - 2B of size data
358
+ return substr($f, $data_offset, $data_size);
359
+ }
360
+
361
+ /**
362
+ * Get data of given chunk
363
+ *
364
+ * @param int chunk number
365
+ * @return string
366
+ */
367
+ private function getChunk($chunk_no)
368
+ {
369
+ if ($chunk_no > $this->icc_chunks) return '';
370
+
371
+ $max_chunk_size = self::MAX_BYTES_IN_MARKER - self::ICC_HEADER_LEN;
372
+ $from = ($chunk_no - 1) * $max_chunk_size;
373
+ $bytes = ($chunk_no < $this->icc_chunks) ? $max_chunk_size : $this->icc_size % $max_chunk_size;
374
+
375
+ return substr($this->icc_profile, $from, $bytes);
376
+ }
377
+
378
+ private function prepareJPEGProfileData()
379
+ {
380
+ $data = '';
381
+
382
+ for ($i = 1; $i <= $this->icc_chunks; $i++)
383
+ {
384
+ $chunk = $this->getChunk($i);
385
+ $chunk_size = strlen($chunk);
386
+ $data .= "\xff\xe2" . pack('n', $chunk_size + 2 + self::ICC_HEADER_LEN); // APP2 segment marker + size field
387
+ $data .= self::ICC_MARKER . pack('CC', $i, $this->icc_chunks); // profile marker inside segment
388
+ $data .= $chunk;
389
+ }
390
+
391
+ return $data;
392
+ }
393
+
394
+ /**
395
+ * Removes profile from JPEG data
396
+ *
397
+ * @param string &data
398
+ * @return bool
399
+ */
400
+ private function removeProfile(&$jpeg_data)
401
+ {
402
+ $len = strlen($jpeg_data);
403
+ $pos = 0;
404
+ $counter = 0; // ehm...
405
+ $chunks_to_go = -1;
406
+
407
+ while ($pos < $len && $counter < 100)
408
+ {
409
+ $pos = strpos($jpeg_data, "\xff", $pos);
410
+ if ($pos === false) break; // no more 0xFF - we can end up with search
411
+
412
+ // analyze next segment
413
+ $type = $this->getJPEGSegmentType($jpeg_data, $pos);
414
+
415
+ switch ($type)
416
+ {
417
+ case 0xe2: // APP2
418
+ $size = $this->getJPEGSegmentSize($jpeg_data, $pos);
419
+
420
+ if ($this->getJPEGSegmentContainsICC($jpeg_data, $pos, $size))
421
+ {
422
+ list($chunk_no, $chunk_cnt) = $this->getJPEGSegmentICCChunkInfo($jpeg_data, $pos);
423
+ if ($chunks_to_go == -1) $chunks_to_go = $chunk_cnt; // first time save chunks count
424
+
425
+ $jpeg_data = substr_replace($jpeg_data, '', $pos, $size + 2); // remove this APP segment from dataset (segment size + 2B app marker)
426
+ $len -= $size + 2; // shorten the size
427
+
428
+ if (--$chunks_to_go == 0) return true; // no more icc profile chunks, store file
429
+
430
+ break; // go out without changing the position
431
+ }
432
+ $pos += $size + 2; // size of segment data + 2B size of segment marker
433
+ break;
434
+
435
+ case 0xe0: // APP0
436
+ case 0xe1: // APP1
437
+ case 0xe3: // APP3
438
+ case 0xe4: // APP4
439
+ case 0xe5: // APP5
440
+ case 0xe6: // APP6
441
+ case 0xe7: // APP7
442
+ case 0xe8: // APP8
443
+ case 0xe9: // APP9
444
+ case 0xea: // APP10
445
+ case 0xeb: // APP11
446
+ case 0xec: // APP12
447
+ case 0xed: // APP13
448
+ case 0xee: // APP14
449
+ case 0xef: // APP15
450
+ case 0xc0: // SOF0
451
+ case 0xc2: // SOF2
452
+ case 0xc4: // DHT
453
+ case 0xdb: // DQT
454
+ case 0xda: // SOS
455
+ case 0xfe: // COM
456
+ $size = $this->getJPEGSegmentSize($jpeg_data, $pos);
457
+ $pos += $size + 2; // size of segment data + 2B size of segment marker
458
+ break;
459
+
460
+ case 0xd8: // SOI
461
+ case 0xdd: // DRI
462
+ case 0xd9: // EOI
463
+ case 0xd0: // RST0
464
+ case 0xd1: // RST1
465
+ case 0xd2: // RST2
466
+ case 0xd3: // RST3
467
+ case 0xd4: // RST4
468
+ case 0xd5: // RST5
469
+ case 0xd6: // RST6
470
+ case 0xd7: // RST7
471
+ default:
472
+ $pos += 2;
473
+ break;
474
+ }
475
+ $counter++;
476
+ }
477
+
478
+ return false;
479
+ }
480
+
481
+ /**
482
+ * Inserts profile to JPEG data.
483
+ *
484
+ * Inserts profile immediately after SOI section
485
+ *
486
+ * @param string &data
487
+ * @return bool
488
+ */
489
+ private function insertProfile(&$jpeg_data)
490
+ {
491
+ $len = strlen($jpeg_data);
492
+ $pos = 0;
493
+ $counter = 0; // ehm...
494
+ $chunks_to_go = -1;
495
+
496
+ while ($pos < $len && $counter < 100)
497
+ {
498
+ $pos = strpos($jpeg_data, "\xff", $pos);
499
+ if ($pos === false) break; // no more 0xFF - we can end up with search
500
+
501
+ // analyze next segment
502
+ $type = $this->getJPEGSegmentType($jpeg_data, $pos);
503
+
504
+ switch ($type)
505
+ {
506
+ case 0xd8: // SOI
507
+ $pos += 2;
508
+
509
+ $p_data = $this->prepareJPEGProfileData();
510
+ if ($p_data != '')
511
+ {
512
+ $before = substr($jpeg_data, 0, $pos);
513
+ $after = substr($jpeg_data, $pos);
514
+ $jpeg_data = $before . $p_data . $after;
515
+ return true;
516
+ }
517
+ return false;
518
+ //break;
519
+
520
+ case 0xe0: // APP0
521
+ case 0xe1: // APP1
522
+ case 0xe2: // APP2
523
+ case 0xe3: // APP3
524
+ case 0xe4: // APP4
525
+ case 0xe5: // APP5
526
+ case 0xe6: // APP6
527
+ case 0xe7: // APP7
528
+ case 0xe8: // APP8
529
+ case 0xe9: // APP9
530
+ case 0xea: // APP10
531
+ case 0xeb: // APP11
532
+ case 0xec: // APP12
533
+ case 0xed: // APP13
534
+ case 0xee: // APP14
535
+ case 0xef: // APP15
536
+ case 0xc0: // SOF0
537
+ case 0xc2: // SOF2
538
+ case 0xc4: // DHT
539
+ case 0xdb: // DQT
540
+ case 0xda: // SOS
541
+ case 0xfe: // COM
542
+ $size = $this->getJPEGSegmentSize($jpeg_data, $pos);
543
+ $pos += $size + 2; // size of segment data + 2B size of segment marker
544
+ break;
545
+
546
+ case 0xdd: // DRI
547
+ case 0xd9: // EOI
548
+ case 0xd0: // RST0
549
+ case 0xd1: // RST1
550
+ case 0xd2: // RST2
551
+ case 0xd3: // RST3
552
+ case 0xd4: // RST4
553
+ case 0xd5: // RST5
554
+ case 0xd6: // RST6
555
+ case 0xd7: // RST7
556
+ default:
557
+ $pos += 2;
558
+ break;
559
+ }
560
+ $counter++;
561
+ }
562
+
563
+ return false;
564
+ }
565
+ }
566
+ ?>
lib/front-view-album-class.php CHANGED
@@ -32,14 +32,14 @@
32
  {
33
  ?>
34
  <br/>
35
- <a class="vlightbox1<?php echo $album_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo $pic_detail[$flag]->title; ?>">
36
  <img style="margin:5px;" src="<?php echo stripcslashes(GALLERY_BK_PLUGIN_URL).'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
37
  <?php
38
  }
39
  else
40
  {
41
  ?>
42
- <a class="vlightbox1<?php echo $album_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo $pic_detail[$flag]->title; ?>">
43
  <img style="margin:5px;" src="<?php echo stripcslashes(GALLERY_BK_PLUGIN_URL).'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
44
  <?php
45
  }
@@ -50,14 +50,14 @@
50
  {
51
  ?>
52
  <br/>
53
- <a class="vlightbox1<?php echo $album_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo $pic_detail[$flag]->title; ?> (<?php echo $pic_detail[$flag]->description; ?>)">
54
  <img style="margin:5px;" src="<?php echo stripcslashes(GALLERY_BK_PLUGIN_URL).'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
55
  <?php
56
  }
57
  else
58
  {
59
  ?>
60
- <a class="vlightbox1<?php echo $album_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo $pic_detail[$flag]->title; ?> (<?php echo $pic_detail[$flag]->description; ?>)">
61
  <img style="margin:5px;" src="<?php echo stripcslashes(GALLERY_BK_PLUGIN_URL).'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
62
  <?php
63
  }
32
  {
33
  ?>
34
  <br/>
35
+ <a class="vlightbox1<?php echo $album_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo stripcslashes($pic_detail[$flag]->title); ?>">
36
  <img style="margin:5px;" src="<?php echo stripcslashes(GALLERY_BK_PLUGIN_URL).'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
37
  <?php
38
  }
39
  else
40
  {
41
  ?>
42
+ <a class="vlightbox1<?php echo $album_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo stripcslashes($pic_detail[$flag]->title); ?>">
43
  <img style="margin:5px;" src="<?php echo stripcslashes(GALLERY_BK_PLUGIN_URL).'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
44
  <?php
45
  }
50
  {
51
  ?>
52
  <br/>
53
+ <a class="vlightbox1<?php echo $album_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo stripcslashes($pic_detail[$flag]->title); ?> (<?php echo stripcslashes($pic_detail[$flag]->description); ?>)">
54
  <img style="margin:5px;" src="<?php echo stripcslashes(GALLERY_BK_PLUGIN_URL).'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
55
  <?php
56
  }
57
  else
58
  {
59
  ?>
60
+ <a class="vlightbox1<?php echo $album_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo stripcslashes($pic_detail[$flag]->title); ?> (<?php echo stripcslashes($pic_detail[$flag]->description); ?>)">
61
  <img style="margin:5px;" src="<?php echo stripcslashes(GALLERY_BK_PLUGIN_URL).'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
62
  <?php
63
  }
lib/gallery-bank-class.php CHANGED
@@ -209,5 +209,4 @@ add_action('init','frontend_plugin_css_scripts_gallery_bank');
209
  add_action('admin_menu','create_global_menus_for_gallery_bank');
210
  add_shortcode('gallery_bank', 'gallery_bank_short_code' );
211
  add_shortcode('gallery_bank_album_cover', 'gallery_bank_short_code_album');
212
- remove_filter( 'the_content', 'wpautop' );
213
  ?>
209
  add_action('admin_menu','create_global_menus_for_gallery_bank');
210
  add_shortcode('gallery_bank', 'gallery_bank_short_code' );
211
  add_shortcode('gallery_bank_album_cover', 'gallery_bank_short_code_album');
 
212
  ?>
lib/in-srgb.jpg ADDED
Binary file
lib/timthumb.php CHANGED
@@ -20,6 +20,7 @@
20
  a new version of timthumb.
21
 
22
  */
 
23
  define ('VERSION', '2.8.2'); // Version of this script
24
  //Load a config file if it exists. Otherwise, use the values below
25
  if( file_exists(dirname(__FILE__) . '/timthumb-config.php')) require_once('timthumb-config.php');
@@ -706,7 +707,13 @@ class timthumb {
706
  $tempfile = tempnam($this->cacheDirectory, 'timthumb_tmpimg_');
707
  if(preg_match('/^image\/(?:jpg|jpeg)$/i', $mimeType)){
708
  $imgType = 'jpg';
709
- imagejpeg($canvas, $tempfile, $quality);
 
 
 
 
 
 
710
  } else if(preg_match('/^image\/png$/i', $mimeType)){
711
  $imgType = 'png';
712
  imagepng($canvas, $tempfile, floor($quality * 0.09));
20
  a new version of timthumb.
21
 
22
  */
23
+ require_once 'class.jpeg_icc.php';
24
  define ('VERSION', '2.8.2'); // Version of this script
25
  //Load a config file if it exists. Otherwise, use the values below
26
  if( file_exists(dirname(__FILE__) . '/timthumb-config.php')) require_once('timthumb-config.php');
707
  $tempfile = tempnam($this->cacheDirectory, 'timthumb_tmpimg_');
708
  if(preg_match('/^image\/(?:jpg|jpeg)$/i', $mimeType)){
709
  $imgType = 'jpg';
710
+ imagejpeg($canvas, $tempfile, $quality);
711
+
712
+ // Add sRGB ICC profile
713
+ $icc = new JPEG_ICC();
714
+ $icc->LoadFromJPEG('in-srgb.jpg');
715
+ $icc->SaveToJPEG($tempfile);
716
+
717
  } else if(preg_match('/^image\/png$/i', $mimeType)){
718
  $imgType = 'png';
719
  imagepng($canvas, $tempfile, floor($quality * 0.09));
readme.txt CHANGED
@@ -1,17 +1,22 @@
1
  === Gallery Bank ===
2
  Contributors: Gallery-Bank
3
- Tags: gallery, image, gallery image, album, foto, fotoalbum, website gallery, multiple pictures, pictures, photo, photoalbum, photogallery, photo gallery, lightbox
4
  Requires at least: 3.0
5
  Tested up to: 3.6 Beta
6
- Stable tag: 1.8.4
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
10
- Gallery Bank is an interactive WordPress photo gallery plugin, best fit for creative and corporate portfolio websites.
11
 
12
  == Description ==
13
 
14
- Create responsive and filterable portfolios with ease on your website. Gallery Bank comes with masonry layout, is designed to adapt each portfolio to any situation and is mobile optimized for responsive themes.
 
 
 
 
 
15
 
16
  <a href="http://gallery-bank.com/forum/support-forum/" target="_blank">Support Desk - feel free to ask your queries</a>
17
 
@@ -21,33 +26,35 @@ Create responsive and filterable portfolios with ease on your website. Gallery B
21
 
22
  = Features =
23
 
24
- * Create any amount of albums in the gallery.
25
- * Add description to each album and then title & description to each image in your album.
26
- * Upoad any number of photos to each album in the gallery.
27
- * Add Single Gallery to your page or post using a shortcode.
28
- * Add a caption to each photo in the album.
 
29
  * Change the size of album cover thumbnails and photos in the album.
30
- * Choose a number of pictures to display in one row in the gallery album.
31
- * View pictures as a slide show and in a full size.
32
- * 3 different Widgets: Display a single album, create a list of album links, display latest/random media
33
  * User-friendly AJAX admin
 
 
34
  * Upload different types of media
35
 
36
  = Pro Version =
37
 
38
  * Domain Installation (x1 change anytime)
39
  * Responsive Gallery
40
- * Creates unlimited amount of albums in the gallery
41
- * Upload unlimited number of photos to each album
42
- * Technical Support for 1 month
43
- * Plugin Updates for Lifetime
44
- * Add Gallery to your Page or Post
45
- * Set featured image as an album cover
46
- * Add description to each album
47
- * Change size of album cover thumbnails & pics
48
- * Choose number of pictures to display in row
49
- * View pictures as a slide show and in a full size
50
- * Change background color
51
 
52
  Visit [here](http://gallery-bank.com) to upgrade to Pro Version now.
53
 
@@ -106,6 +113,11 @@ Visit [here](http://gallery-bank.com) to upgrade to Pro Version now.
106
 
107
  = 1.8.4 =
108
 
 
 
 
 
 
109
  * Introduced Sorting of Images in an Album
110
  * Album Formatting conflict resolved
111
 
1
  === Gallery Bank ===
2
  Contributors: Gallery-Bank
3
+ Tags: gallery, image, gallery images, album, foto, fotoalbum, website gallery, multiple pictures, pictures, photo, photoalbum, photogallery, photo gallery, lightbox,media, nextgen, nextgen gallery,photo, photo albums, picture, pictures, thumbnails, slideshow
4
  Requires at least: 3.0
5
  Tested up to: 3.6 Beta
6
+ Stable tag: 1.8.5
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
10
+ Gallery Bank is an easy to use Responsive WordPress Gallery Plugin for photos galleries and albums.
11
 
12
  == Description ==
13
 
14
+ Gallery Bank is the WordPress plugin that allows you to create photo galleries with an ease in your WordPress websites.
15
+ Multiple albums can be added along with titles and descriptions in the gallery.
16
+ It has the ability to upload images, with options like adding, deleting and sorting image, and editing thumbnails; group galleries into albums.
17
+ You can enjoy the slide show feature in the Gallery Bank.
18
+ Gallery Bank is designed to adapt each portfolio to any situation and can be easily used on mobiles as it is a Responsive plugin.
19
+
20
 
21
  <a href="http://gallery-bank.com/forum/support-forum/" target="_blank">Support Desk - feel free to ask your queries</a>
22
 
26
 
27
  = Features =
28
 
29
+ * In an album you can add unlimited number of pictures /images.
30
+ * Easy to edit pictures/images.
31
+ * Set the cover for the album.
32
+ * Add Single Gallery or Display Images to your page or post using a shortcode.
33
+ * Sorting can be done in albums.
34
+ * Caption to photo album.
35
  * Change the size of album cover thumbnails and photos in the album.
36
+ * Light box view of the images/pictures.
37
+ * Option to add description and titles to the images.
38
+ * View pictures in a slide show and in a full size.
39
  * User-friendly AJAX admin
40
+ * Choose a number of pictures to display in one row in the gallery album.
41
+ * Easy to delete images/pictures.
42
  * Upload different types of media
43
 
44
  = Pro Version =
45
 
46
  * Domain Installation (x1 change anytime)
47
  * Responsive Gallery
48
+ * Creates unlimited amount of albums in the gallery.
49
+ * Upload unlimited number of photos to each album.
50
+ * Technical Support for 1 month.
51
+ * Plugin Updates for Lifetime.
52
+ * Add Gallery to your Page or Post.
53
+ * Set featured image as an album cover.
54
+ * Add description to each album.
55
+ * Change size of album cover thumbnails & pics.
56
+ * Choose number of pictures to display in row.
57
+ * View pictures as a slide show and in a full size.
 
58
 
59
  Visit [here](http://gallery-bank.com) to upgrade to Pro Version now.
60
 
113
 
114
  = 1.8.4 =
115
 
116
+ * Timbthumb Quality Issues Fixed
117
+ * Formatting Issue Resolved
118
+
119
+ = 1.8.4 =
120
+
121
  * Introduced Sorting of Images in an Album
122
  * Album Formatting conflict resolved
123
 
views/front_view.php CHANGED
@@ -31,14 +31,14 @@
31
  {
32
  ?>
33
  <br/>
34
- <a class="vlightbox1<?php echo $unique_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo $pic_detail[$flag]->title; ?>">
35
  <img style="margin:5px;" src="<?php echo stripcslashes(GALLERY_BK_PLUGIN_URL).'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
36
  <?php
37
  }
38
  else
39
  {
40
  ?>
41
- <a class="vlightbox1<?php echo $unique_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo $pic_detail[$flag]->title; ?>">
42
  <img style="margin:5px;" src="<?php echo stripcslashes(GALLERY_BK_PLUGIN_URL).'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
43
  <?php
44
  }
@@ -49,14 +49,14 @@
49
  {
50
  ?>
51
  <br/>
52
- <a class="vlightbox1<?php echo $unique_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo $pic_detail[$flag]->title; ?> (<?php echo $pic_detail[$flag]->description; ?>)">
53
  <img style="margin:5px;" src="<?php echo stripcslashes(GALLERY_BK_PLUGIN_URL).'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
54
  <?php
55
  }
56
  else
57
  {
58
  ?>
59
- <a class="vlightbox1<?php echo $unique_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo $pic_detail[$flag]->title; ?> (<?php echo $pic_detail[$flag]->description; ?>)">
60
  <img style="margin:5px;" src="<?php echo GALLERY_BK_PLUGIN_URL.'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
61
  <?php
62
  }
31
  {
32
  ?>
33
  <br/>
34
+ <a class="vlightbox1<?php echo $unique_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo stripcslashes($pic_detail[$flag]->title); ?>">
35
  <img style="margin:5px;" src="<?php echo stripcslashes(GALLERY_BK_PLUGIN_URL).'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
36
  <?php
37
  }
38
  else
39
  {
40
  ?>
41
+ <a class="vlightbox1<?php echo $unique_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo stripcslashes($pic_detail[$flag]->title); ?>">
42
  <img style="margin:5px;" src="<?php echo stripcslashes(GALLERY_BK_PLUGIN_URL).'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
43
  <?php
44
  }
49
  {
50
  ?>
51
  <br/>
52
+ <a class="vlightbox1<?php echo $unique_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo stripcslashes($pic_detail[$flag]->title); ?> (<?php echo stripcslashes($pic_detail[$flag]->description); ?>)">
53
  <img style="margin:5px;" src="<?php echo stripcslashes(GALLERY_BK_PLUGIN_URL).'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
54
  <?php
55
  }
56
  else
57
  {
58
  ?>
59
+ <a class="vlightbox1<?php echo $unique_id;?>" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo stripcslashes($pic_detail[$flag]->title); ?> (<?php echo stripcslashes($pic_detail[$flag]->description); ?>)">
60
  <img style="margin:5px;" src="<?php echo GALLERY_BK_PLUGIN_URL.'/lib/timthumb.php?src='.stripcslashes($pic_detail[$flag]->pic_path).'&h=150&w=150&zc=1&q=100';?>"/></a>
61
  <?php
62
  }
views/view-album.php CHANGED
@@ -140,14 +140,14 @@
140
  if($pic_detail[$flag]->description == "")
141
  {
142
  ?>
143
- <a class="vlightbox1" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo $pic_detail[$flag]->title; ?>">
144
  <img class="imgHolder" src="<?php echo $pic_detail[$flag]->pic_path; ?>" style="border:3px solid #e5e5e5"; width="150px;"/></a>
145
  <?php
146
  }
147
  else
148
  {
149
  ?>
150
- <a class="vlightbox1" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo $pic_detail[$flag]->title; ?> (<?php echo $pic_detail[$flag]->description; ?>)">
151
  <img class="imgHolder" src="<?php echo $pic_detail[$flag]->pic_path; ?>" style="border:3px solid #e5e5e5"; width="150px;"/></a>
152
  <?php
153
  }
140
  if($pic_detail[$flag]->description == "")
141
  {
142
  ?>
143
+ <a class="vlightbox1" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo stripcslashes($pic_detail[$flag]->title); ?>">
144
  <img class="imgHolder" src="<?php echo $pic_detail[$flag]->pic_path; ?>" style="border:3px solid #e5e5e5"; width="150px;"/></a>
145
  <?php
146
  }
147
  else
148
  {
149
  ?>
150
+ <a class="vlightbox1" id="<?php echo $pic_detail[$flag]->pic_id; ?>" href="<?php echo $pic_detail[$flag]->pic_path; ?>" title="<?php echo stripcslashes($pic_detail[$flag]->title); ?> (<?php echo stripcslashes($pic_detail[$flag]->description); ?>)">
151
  <img class="imgHolder" src="<?php echo $pic_detail[$flag]->pic_path; ?>" style="border:3px solid #e5e5e5"; width="150px;"/></a>
152
  <?php
153
  }