[...] Picture grabber, resizer and cropper [...]

English version here
Quante volte nei post WordPress utilizziamo delle immagini prese da qualche parte, poi le adattiamo affinchè pesino meno o calzino bene nel nostro layout.
Con questo plugin l’operazione di download, crop, resize viene fatta in modo automatico.
In più è possibile specificare un tempo di caching delle immagini, per cui l’immagine sorgente sarà prelevata solo alla scadenza del tempo di caching che volendo può essere infinito.
L’utilizzo è estremamente semplice: basta aggiungere l’ attributo “resize” nel tag img dell’immagine che vogliamo caricare/ridimensionare/ritagliare.
Per cui ammettiamo di voler includere nel nostro post questa immagine.
E’ molto grande e pesante, l’ho scelta apposta come esempio.
Per poterne caricare una miniatura quindi occorrerebbe ridimensionarla manualmente.
Con PicGrab invece basta inserire questo codice nel post:
<img src=”http://foto.zellini.org/albums/prima-porta/antiche-mura-villa-di-livia.jpg” resize=”300x200c;inf” />
Il risultato (chiaramente abilitando il plugin) è quello che vedete qui sotto.
E’ anche possibile prendere delle parti specifiche dell’immagine.
<img src=”http://foto.zellini.org/albums/prima-porta/antiche-mura-villa-di-livia.jpg” resize=”(926,502,480,320)300x200c;inf” />
In questo caso la parte dell’immagine che mi interessa è un rettangolo di dimensioni 480×320, a partire dal punto 926,502
<img src=”http://meteo.vallemuricana.com/webcam/valle-muricana-lr.jpg” resize=”300x200c0;30m” />
In questo caso prendo l’immagine di una webcam, quindi imposto il tempo di cache a 30 minuti.
Il formato dell’attributo “resize” è questo:
[(x0,y0,xs,ys)]<xd>x|x<yd>|<xd>x<yd>[c[<crop>]][;<cachetime>]
Esempi: 100x, x200, 100×50, 100x200c50, 100x200c
Come dicevo nell’esempio è possibile applicare il resize e crop a una sola parte dell’immagine sorgente:
in questo caso basta identificare la sezione rettangolare di partenza specificandola tra parentesi tonde.
(100,50,300,200) seleziona un’area rettangolare di dimensione 300×200 pixel a partire dal punto con coordinate (100,100).
A questo rettangolo poi verrà applicato il crop/resize.
Per maggiori informazioni sul resizer potete fare riferimento a questo post.
L’unità di misura di default per cachetime è il secondo, tuttavia è possibile forzare altre unità di misura facendo seguire al numero una lettera che identifica l’unità di misura:
Il massimo valore è 2^31, ovvero 67 anni circa.
Per un tempo infinito di cache specificare “inf”
In quest’ultimo caso l’immagine, una volta presa, non viene più ricaricata dalla sorgente.
Problemi e dubbi
Il resizer richiede obbligatoriamente le librerie curl e gd e php >=5.
La directory “picscache” deve avere i permessi di scrittura per tutti (777).
L’ultima versione di PicGrab è scaricabile direttamente da WordPress.org qui.
Ringrazio Mambro per il logo con le forbicione!
(sorry in advance for errors)
Picgrab is a plugin that download, resize and crop an image on the fly.
Simply add the “resize” attribute in the img tag you want to grab & resize on your post.
E.g.
<img src=”http://farm4.static.flickr.com/3532/3243887563_700849f242.jpg” resize=”402x200c;66y” />
Once activated, the plugin replaces the attribute “src” on img tags containing the “resize” attribute with something like:
http://yoursite/wp-content/plugins/picgrab/resize.php?url=e%3BI%3AEex%2AVXP%2AsdT7h%2AX%26Qb%5EH%3B8r_yk%25q%28%217J-u%24%29olkPl%2A%60_i2O7%7E%7E%2A%2A%2FE%2F&size=XSe44URI%2Bb%21CS
and removes the “resize” attribute.
The resize.php script included with plugin does the work to grab, crop and resize the image.
It also manages the cache.
The resize attribute format is:
[(x0,y0,xs,ys)]<xd>x|x<yd>|<xd>x<yd>[c[<crop>]][;<cachetime>]
e.g. 100x, x200, 100×50, 100x200c50, 100x200c
Refer to this post for more information on resizer.
Cachetime default unit is second: you can specify other unit after the time value.
E.g. 10m = 10 minutes, 2d = 2 days, 65y = 65 years.
Allowed units are:
max cache value is (2^31) 67 year circa.
Special value “inf” means infinite cache.
In this once grabbed, plugin uses always cached image.
Troubleshooting:
Resizer functions require php curl and gd libraries and php version >=5.
The “picscache” folder must be writable by all (777 permission)
Download the latest PicGrab version directly from WordPress.org here
Many thanks to Mambro for the logo.
Stai leggendo “ PicGrab, a WordPress plugin to grab, resize, crop and cache images ”, un post di Fabrizio Zellini
[...] Picture grabber, resizer and cropper [...]
Hi there. I just installed your plugin and am getting this error. Any help would be great, thanks!
Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of preg_match_all(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in /home/.felicja/rubinstarset/rubin.starset.net/wp-content/plugins/picgrab/picgrab.php on line 48
Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of preg_match_all(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in /home/.felicja/rubinstarset/rubin.starset.net/wp-content/plugins/picgrab/picgrab.php on line 55
Running WordPress trunk.
Just change “&$matches” with “$matches” in lines #55 and #48 (remove the &), I will fix it in the distribution on next release.
hi…nice idea, but it wont work for me.
i got everything, php 5.2.6, curl…the folder is 777!
this also do not work:
<img src=”" resize=”200x200c50″ /> – it showing the image but does not resize
even if i do this:
any ideas?
Toul, check if the gd lib is installed,
try with resize=”200x200c50;inf”
check error log
Thanx for your fast response! The gd lib is installed (GD Version bundled (2.0.34 compatible)) – i find no image in the picscache folder. i am running wp 2.7.1 @ localhost.
Thanx for your fast response! The gd lib is installed (GD Version bundled (2.0.34 compatible)) – i find no image in the picscache folder. i am running wp 2.7.1 @ localhost.
in the source of the page:
instead of
http://yoursite/wp-content/plugins/picgrab/resize.php?url=&size= and removes the “resize” attribute.
in the source of the page:
instead of
http://yoursite/wp-content/plugins/picgrab/resize.php?url=&size=
How can I grab pic and resize from the main page(index.php)? I want to resize the pic from the main page of of WordPress site, I add tag “resize….” inside the loop but it didn’t work.
If you want to resize from the main page you have to grab some code from the plugin and report in the template code of the home page.
Actually the plugin works parsing the content of a post, so the “resize” attribute only works on posts.
Hi there
Checked the folder is 777 – the only thing i’m unsure about is the gd Lib – how can I check that?
Showing the image – but not resized…
Make a file with this code:
<?php
phpinfo();
?>
name it “phpinfo.php”
Upload it on your web server, then access the page, the phpinfo function will dump a lot of information regarding extension, including gd.
All seems to be there?
http://www.aboutsal.com/phpinfo.php
PHP Version 5.2.5
gd
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.9
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
Ciao,
bellissmo plugin! Io invece sto cercando (se esiste) un plugin che nella Homepage del blog faccia vedere l’immagine del post in un certo modo (solo in parte magari piuttosto che + piccola o addirittura diversa) e solo dopo che un utente visualizza l’articolo per intero faccia vedere l’immagine completa. Che tu sappia esiste?
Grazie in anticipo per l’aiuto.
I’ve been looking into on-the-fly resizing of images and tried my own way using a script by joedesign. It works on some servers, and on others it does not.
How would I go about extracting the necessary code to use resizing in a functions.php file?
I try to make things simple for my users and attach images to posts WITHOUT inserting them into the content area – the theme then extracts the images and displays them in a resized version.
Please Help
I’m sure you can make a plug for auto resize better than timthumb because the url they generate are disgusting.
Many of us only needs to resize function for put the tag in the templates theme archives.
Not only for just a thumbnail like 2.9
Without crop, without any interaction, that’s what the editor.
And most important a clean url, similar to that already generates one of your plug:
example: http://www.hola.com/posh-spice-150×150.jpg
Good luck with everything!
XHTML: Puoi usare questi tag: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
17 Commenti
commenta | feed commenti [?] | trackback uri [?]