These php functions are available ( there are more, of course, but i think these are usefull for your purpose ):
wppa_get_youngest_photo_id();
returns the id of most recently uploaded photo.
If you want, i can add in the next version:
wppa_get_youngest_photo_ids( $n = '3' );
that will return an array sorted by descending timestamp with the youngest n photo ids.
wppa_get_thumb_url( $id );
returns the url to the photo file.
wppa_get_photo_url( $id );
returns the url to the displaysize photo file.
If you need more, please ask me.
Thread Starter
Odyno
(@odyno)
Thanks a lot! 🙂
I peeked into the code, and I find other functions! I choose to build this snippet of code. https://gist.github.com/Odyno/8b338c7d202125ada3dd.
Simply, I query the database to retrieve the base data, then I start to retrieve the information with the common wppa+ functions.
So I use
wppa_get_thumb_url( $id ); , other function like wppa_get_album_name() and wppa_get_thumb_url( $id ); but the last return the url “wp-content/uploads/wppa/5.jpg?ver=1”
So, I don’t found this 3 feature, can you help me?
- exist some function usable to retrieve the original src location of photo (to embed in to img tag)?
- exists a function usable to retrieve the “modify” and “delete” link of single photo?
- exist (I think it’s very hard) a function to retrieve if exist a page comment of photo?
thanks!
1:
wppa_get_lores_url( $id ); // Display size ( optionally resized during upload )
wppa_get_hires_url( $id ); // Highes available resulution, orig source if save during upload – See table IX-H – else same as above
wppa_get_tnres_url( $id ); // Effecively the same as wppa_get_thumb_url( $id );
wppa_get_source_pl( $id ); // A human readable permalink to the original source file if saved during upload, else ”;
All the above are suitable for img tag. However note that the permalink requires uniqueness of album names and photo names inside the album.
2:
Try this code snippet:
// Edit link
if ( ! wppa_is_user_blacklisted() ) {
if ( ( wppa_user_is( 'administrator' ) ) || ( wppa_get_user() == wppa_get_photo_owner( $id ) && wppa_switch( 'wppa_upload_edit' ) ) ) {
$wppa['out'] .= wppa_nltab().'<div class="wppa-thumb-text" style="'.__wcs( 'wppa-thumb-text' ).'" >
<a href="javascript:void();" style="color:red;" onclick="'.esc_attr( 'if ( confirm( "'.__a( 'Are you sure you want to remove this photo?' ).'" ) ) wppaAjaxRemovePhoto( '.$wppa['mocc'].', '.$id.', false ); return false;' ).'">
'.__a( 'Delete' ).'
</a>
<a href="javascript:void();" style="color:green;" onclick="wppaEditPhoto( '.$wppa['mocc'].', '.$id.' ); return false;" >
'.__a( 'Edit' ).'
</a>
</div>';
}
}
Change $wppa['out'] .= into echo and remove any wppa_nltab(), and use '1' for $wppa['mocc']
I did not test this outsie its original context by expect no big issues.
3:
Look at file wppa-boxes.php, function wppa_comment_html(); section:
// Loop the comments already there
Thread Starter
Odyno
(@odyno)
wow!!
Thank you again for everything you’ve done.
BTW, This is also what you need to know:
wppa_get_photo_name( $id ); // returns the post-processed name of the photo ( qTranslate language filtered and stripsleshed etc. )
wppa_get_photo_desc( $id ); // returns the post-processed description ( additionally with w# keywords translated etc, see http://wppa.opajaap.nl/geographic-data/ )
wppa_get_photo_item( $id, $item ) // returns the raw data.
For available items see: wppa_create_photo_entry( $args ); in wppa-wpdb-insert.php