i think (maybe) your variable is not passing to java…
try:
‘echo ‘<script language=”javascript”>
function imprimer(){
fenetre=window.open(“‘;
echo $url;
echo ‘” );
fenetre.print();
fenetre.top.close();
}
</script>’;
also, (maybe)if there is more than one url in array $thumb[0] you should use a foreach statement…
Thks, but doesn’t work…
Maybe the best idea it’s make a print.css
Sorry the web is in locahost
The html code:
<script language="javascript">
function imprimer(){
fenetre=window.open("http://localhost:8888/cocina/wp-content/uploads/2012/07/leon.jpg" );
fenetre.print();
fenetre.top.close();
}
</script><a href="javascript:imprimer()">Imprimer</a>
The print windows its opening Ok, but not image
Hi,
I found the solutions. Maybe is useful for somebody
Source:
http://dynom.nl/jquery/print_popup.html
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
// <!--
/*
* See: http://blog.dynom.nl/archives/Javascript-printing-a-popup-window_20091029_52.html
*/
/**
* To put it in jQuery terms:
*/
Popup = {
init : function () {
$('a.action_print').bind('click', Popup.printIt);
},
printIt : function () {
var win = window.open('', 'Image', 'resizable=yes,...');
if (win.document) {
win.document.writeln('<img src="'+ $(this).attr('href') +'" alt="image" />');
win.document.close();
win.focus();
win.print();
}
return false;
}
}
$(document).ready(function () {
Popup.init();
});
// -->
</script>
And put this in your theme:
<?php
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );
$urls = $thumb['0'];
echo '<a class="action_print" href="'.$urls.'">Print image</a>';
?>