Exemplo n.º 1
0
/**
 * List images in specified folder
 * Used within image picker
 * @since 1.0
 */
function wppb_list_images($wppb_image_dir, $wppb_image_url, $no_image, $folder)
{
    // Setting folder variable in case it's empty
    if (empty($folder)) {
        $folder = '';
    }
    $file_list = wppb_list_files($wppb_image_dir);
    if (is_array($file_list)) {
        $col = 0;
        $first = '';
        foreach ($file_list as $file) {
            $col++;
            if ($col == 1) {
                echo '<tr>';
            }
            if ($col == 1 && $first != 'no' && 'display' == $no_image) {
                echo '<td>' . __('No image', 'wppb_lang') . '<br /><img src="' . WPPB_URL . '/images/no-image.jpg" class="uploaded-image" alt="" /></td>';
                $first = 'no';
                $col++;
            }
            echo '<td>' . $file . '<br /><img src="' . $wppb_image_url . '/' . $file . '" class="uploaded-image" alt="' . $folder . '/' . $file . '" /></td>';
            if ($col == 4) {
                echo '</tr>';
                $col = 0;
            }
        }
    }
}
Exemplo n.º 2
0
/**
 * Display list of uploaded images
 * @since 0.1
 */
function wppb_display_images()
{
    $file_list = wppb_list_files(wppb_storage_folder('images'));
    if (is_array($file_list)) {
        foreach ($file_list as $file) {
            echo '<li>
				<a href="' . wppb_storage_folder('images', 'url') . '/' . $file . '">' . $file . '</a>
				<input class="delete_file" type="submit" name="delete_file" value="' . $file . '" />
				<br />
				<a href="' . wppb_storage_folder('images', 'url') . '/' . $file . '">
					<img src="' . wppb_storage_folder('images', 'url') . '/' . $file . '" class="uploaded-image" alt="" />
				</a>
			</li>';
        }
    }
}