@ukf – Although the image filename is taken out of context in your example, you are correct in that it is dynamically created. The name is based on several factors such as the display(s), the thumbnail size(s), and how you are inserting the image(s).
What are you specifically looking for?
– Cais.
Thread Starter
UKF
(@ukf)
I want to query this dynamic thumbnail. I want to show the previewpicture of a specific gallery ID. This works with
$gallery_id = "1";
$results = $wpdb->get_results("SELECT ng.path, np.filename, np.description, np.alttext, np.pid, np.updated_at FROM wp_ngg_pictures np, wp_ngg_gallery ng WHERE np.galleryid=ng.gid AND np.galleryid=".$gallery_id." AND np.pid=ng.previewpic",ARRAY_A);
if(!empty($results[0]['path']) && !empty($results[0]['filename'])) :
$imgpaththumb = $results[0]['path'].'/thumbs/thumbs_'.$results[0]['filename'];
With this query I only get the normal thumbnail which has a size of width:300. In my dynamic folder is that thumbnail with width:400. How can I manually query that dynamic thumbnail ?
The numbers are generated in nextgen-gallery/products/photocrati_nextgen/modules/dynamic_thumbnails/class.dynamic_thumbnails_manager.php in get_name_from_params()
The following code will retrieve the gallery & image and then give you the path to the image full URL, a dynamicly generated clone, and the official thumbnail:
<?php
$dynthumbs = C_Dynamic_Thumbnails_Manager::get_instance();
$gallery_mapper = C_Gallery_Mapper::get_instance();
$image_mapper = C_Image_Mapper::get_instance();
$gallery = $gallery_mapper->find($gallery_id);
if (!empty($gallery->previewpic) {
$image = $image_mapper->find($gallery->previewpic);
$dynamic_parameters = array(
'width' => '100',
'height' => '100',
'quality' => '100',
'crop' => TRUE,
'watermark' => FALSE
);
$thumbnail_size_name = $dynthumbs->get_size_name($dynamic_parameters);
$full_url = $storage->get_image_url($image, 'full');
$dynamic_url = $storage->get_image_url($image, $thumbnail_size_name, TRUE);
$thumb_url = $storage->get_image_url($image, 'thumb');
}
I hope that helps!