WP Photo Album Plus - Version 7.6.07.008

Version Description

= 7.6.07 =

  • This version addresses various minor bug fixes and feature requests.
Download this release

Release Info

Developer opajaap
Plugin Icon wp plugin WP Photo Album Plus
Version 7.6.07.008
Comparing to
See all releases

Code changes from version 7.6.07.007 to 7.6.07.008

Files changed (4) hide show
  1. wppa-ajax.php +31 -1
  2. wppa-photo-files.php +18 -7
  3. wppa-upload-common.php +3 -3
  4. wppa.php +2 -2
wppa-ajax.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
- * Version 7.6.07.001
6
  *
7
  */
8
 
@@ -2497,8 +2497,38 @@ global $wppa;
2497
  }
2498
  }
2499
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2500
  // A photo
2501
  else {
 
2502
  media_sideload_image( wppa_get_hires_url( $photo ), 0, wppa_get_photo_desc( $photo ) );
2503
  }
2504
  }
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
+ * Version 7.6.07.008
6
  *
7
  */
8
 
2497
  }
2498
  }
2499
 
2500
+ // A pdf?
2501
+ elseif ( wppa_is_pdf( $photo ) ) {
2502
+
2503
+ wppa( 'no_ver', true ); // Next get_photo_url without ver=... , please
2504
+ $pdf_url = wppa_get_hires_url( $photo );
2505
+ $pdf_tmp = download_url( $pdf_url );
2506
+
2507
+ if ( is_wp_error( $pdf_tmp ) ) {
2508
+ wppa_log( 'err', "Image Download $pdf_url Fail:" . is_wp_error( $pdf_tmp ) );
2509
+ }
2510
+
2511
+ if ( ! is_wp_error( $pdf_tmp ) ) {
2512
+ $pdf_size = filesize( $pfd_temp );
2513
+ $pdf_name = wppa_get_photo_name( $photo );
2514
+
2515
+ // Download complete now upload in wp media
2516
+ $file = array(
2517
+ 'name' => $pdf_name,
2518
+ 'type' => 'document/pdf',
2519
+ 'tmp_name' => $pdf_tmp,
2520
+ 'error' => 0,
2521
+ 'size' => $pdf_size
2522
+ );
2523
+
2524
+ // This image/file will show on media page...
2525
+ $thumb_id = media_handle_sideload( $file, 0, wppa_get_photo_desc( $photo ) );
2526
+ }
2527
+ }
2528
+
2529
  // A photo
2530
  else {
2531
+ wppa_log( 'OBS', 'Trying to add to WP media: '.wppa_get_hires_url( $photo ) );
2532
  media_sideload_image( wppa_get_hires_url( $photo ), 0, wppa_get_photo_desc( $photo ) );
2533
  }
2534
  }
wppa-photo-files.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-photo-files.php
3
  *
4
  * Functions used to create/manipulate photofiles
5
- * Version 7.6.07.006
6
  *
7
  */
8
 
@@ -184,20 +184,31 @@ wppa_log('dbg', 'make called with'.$file.' '.$id.' '.$ext.' '.$do_thumb. ' exist
184
  if ( wppa_is_file( $disp ) ) {
185
  wppa_unlink( $disp );
186
  }
187
-
188
- // Prepare for creating displayfile
189
- $file = $jpg;
190
- $ext = 'jpg';
191
  }
192
  }
193
 
194
- // If could not make jpg source use documentstub
195
- if ( ! wppa_is_file( $jpg ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  wppa_copy( $documentstub, $png );
197
  wppa_update_photo( array( 'id' => $id, 'ext' => 'png' ) );
198
  $file = $png;
 
199
  }
200
 
 
201
  clearstatcache();
202
  wppa_cache_thumb( 'invalidate', $id );
203
  $thumb = wppa_cache_thumb( $id );
2
  /* wppa-photo-files.php
3
  *
4
  * Functions used to create/manipulate photofiles
5
+ * Version 7.6.07.008
6
  *
7
  */
8
 
184
  if ( wppa_is_file( $disp ) ) {
185
  wppa_unlink( $disp );
186
  }
 
 
 
 
187
  }
188
  }
189
 
190
+ // Find what we have to create display and thumbfiles
191
+ // First look for jpg
192
+ if ( wppa_is_file( $jpg ) ) {
193
+ wppa_update_photo( array( 'id' => $id, 'ext' => 'jpg' ) );
194
+ $file = $jpg;
195
+ $ext = 'jpg';
196
+ }
197
+ // Then look for png
198
+ elseif( wppa_is_file( $png ) ) {
199
+ wppa_update_photo( array( 'id' => $id, 'ext' => 'png' ) );
200
+ $file = $png;
201
+ $ext = 'png';
202
+ }
203
+ // Last resort: use document stub
204
+ else {
205
  wppa_copy( $documentstub, $png );
206
  wppa_update_photo( array( 'id' => $id, 'ext' => 'png' ) );
207
  $file = $png;
208
+ $ext = 'png';
209
  }
210
 
211
+ // Hoesekeeping
212
  clearstatcache();
213
  wppa_cache_thumb( 'invalidate', $id );
214
  $thumb = wppa_cache_thumb( $id );
wppa-upload-common.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains common upload functions
6
- * Version 7.6.07.007
7
  *
8
  */
9
 
@@ -64,7 +64,7 @@ global $wppa_supported_document_extensions;
64
  $ext_type = 'image';
65
  }
66
  else {
67
- $ex_type = 'unknown';
68
  }
69
  }
70
 
@@ -162,7 +162,7 @@ global $wppa_supported_document_extensions;
162
 
163
  // Process posterfile or update existing image file (dups not allowed)
164
  if ( $ext_type == 'video' || $ext_type == 'audio' || $ext_type == 'document' || $ext_type == $new_type ) {
165
- wppa_log( 'dbg', 'Updating ' . $ext_id . ', ' . $file['name'] . ' ' . $ext_type . ' width ' . $the_type );
166
  wppa_move_uploaded_file( $file['tmp_name'], wppa_get_source_album_dir( $album ) . '/' . $file['name'] );
167
  if ( $ext_type == 'document' ) {
168
  wppa_update_photo( array( 'id' => $ext_id, 'ext' => $the_type ) );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains common upload functions
6
+ * Version 7.6.07.008
7
  *
8
  */
9
 
64
  $ext_type = 'image';
65
  }
66
  else {
67
+ $ext_type = 'unknown';
68
  }
69
  }
70
 
162
 
163
  // Process posterfile or update existing image file (dups not allowed)
164
  if ( $ext_type == 'video' || $ext_type == 'audio' || $ext_type == 'document' || $ext_type == $new_type ) {
165
+ wppa_log( 'dbg', 'Updating ' . $ext_id . ', ' . $file['name'] . ' ' . $ext_type . ' with ' . $the_type );
166
  wppa_move_uploaded_file( $file['tmp_name'], wppa_get_source_album_dir( $album ) . '/' . $file['name'] );
167
  if ( $ext_type == 'document' ) {
168
  wppa_update_photo( array( 'id' => $ext_id, 'ext' => $the_type ) );
wppa.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  * Plugin Name: WP Photo Album Plus
4
  * Description: Easily manage and display your photo albums and slideshows within your WordPress site.
5
- * Version: 7.6.07.007
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
@@ -24,7 +24,7 @@ global $wp_version;
24
 
25
  /* WPPA GLOBALS */
26
  global $wppa_revno; $wppa_revno = '7607'; // WPPA db version
27
- global $wppa_api_version; $wppa_api_version = '7.6.07.007'; // WPPA software version
28
 
29
  /* Init page js data */
30
  global $wppa_js_page_data; $wppa_js_page_data = '';
2
  /*
3
  * Plugin Name: WP Photo Album Plus
4
  * Description: Easily manage and display your photo albums and slideshows within your WordPress site.
5
+ * Version: 7.6.07.008
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
24
 
25
  /* WPPA GLOBALS */
26
  global $wppa_revno; $wppa_revno = '7607'; // WPPA db version
27
+ global $wppa_api_version; $wppa_api_version = '7.6.07.008'; // WPPA software version
28
 
29
  /* Init page js data */
30
  global $wppa_js_page_data; $wppa_js_page_data = '';