on Blogging

Image Extractor

Image extractor - plugin per wordpress
Image Extractor is a WordPress plugin that extract the first image from the post and display it. The "Image Extractor" main feature is the capability to resize the image found to a wanted size. The final image is cached in a folder, so you can obtain better performances.

How to install

  • Download the .zip file and extract it
  • Upload the extrated folder (imageExtractor/) to the WordPress plugins folder (wp-content/plugins/)
  • Configure the imageExtractor.php file and set the right cache folder. Make sure it’s writable.
  • Activate the plugin from the WordPress back office panel

How to use

Image Extractor will enable a new template function. It output a complete IMG tag to be inserted into your HTML code. The image source is retrieved from the first image found in the current post. Here is an example showing you how to use it:

  while (have_posts()) : the_post();
    image_extractor(true, 1, 395, 0, '', '', '<div>', '</div>');

The syntax is:

  image_extractor($resize=false, $resize_type=1, $width='', $height='', $class='', $id='', $prefix='', $suffix='')


  • resize: indicate if the plugin has to resize the image and store it in the cache folder
  • resize_type: there are 3 type of resizing:
    • 0 -> image will be resized to the new output size, regardless of the original aspectratio. (default)
    • 1 -> image will be cropped if necessary to preserve the aspectratio and avoid image distortions.
    • 2 -> image will be resized preserving its original aspectratio. differences to the new outputsize will be filled with white
  • width: the destination width. If resize is false, this property only add/change the WIDTH attribute of the IMG tag
  • height: the destination height. If resize is false, this property only add/change the HEIGHT attribute of the IMG tag
  • class: add or change the CLASS attribute of the IMG tag
  • id: add or change the ID attribute of the IMG tag
  • prefix: add a prefix to the resulting IMG tag
  • suffix: append a suffix to the resulting IMG tag

The resulting effect is cool! You can resize the post dimension as you want! Here is a screenshot!
PS: Wowww, WordPress staff has just approved my first plugin!!! I’m very very happy. You can find "Image Extractor" on the official WordPress plugin repository.resulting-effect-image-extractor

145 Commenti

  1. Is there any code to extract the videos from post which i have embed through “Viper’s Video Quicktags” plugin

  2. Hello,

    Today I enabled WP_DEBUG on my wp-config.php file and I’m getting thousands of Uninitialized string offset errors in htmlParser.php.
    Actually it’s a loop of these 3 errors below:
    PHP Notice: Uninitialized string offset: 171 in /var/www/html/wp-content/plugins/imageExtractor/htmlParser.php on line 115
    PHP Notice: Uninitialized string offset: 171 in /var/www/html/wp-content/plugins/imageExtractor/htmlParser.php on line 126
    PHP Notice: Uninitialized string offset: 171 in /var/www/html/wp-content/plugins/imageExtractor/htmlParser.php on line 138

    What those lines have in common is $line[$charsindex] but I’m a complete PHP n00b so I don’t know what to do to fix this.

    Any ideas?


    • That are “notices” and they aren’t “errors”. The messages mean that a variable wasn’t initialized ($variable = “” ), but the script could run anyway.

  3. Does this plugin only resizes the original image or it also crops it according to the size…?

  4. Sir, can you please explain how to change the output files to jpg?
    I use this code on my home page (as part of Visual Recent Posts) and the png thumbnails are too large. Thanks!

    • Open the imageExtractor.php file (you find in the wp-content/plugins/imageExtractor/) and edit the line 116.
      Change the following code:
      where the change is the text “jpg” instead of “png24”.

      Hope this could help you.

  5. For those who have this problem:

    Fatal error: Image: Imagetype (jpg) not supported for reading

    This is due to a php version >5.3.
    Fix this error by patching the class.ImageToolbox.php. Replate the line 203:
    if ($gd_info[‘JPG Support’]) {
    with this:
    if ($gd_info[‘JPG Support’] or $gd_info[‘JPEG Support’]) {

    Hope this could help u…

  6. Hello Mike,
    thanks for this great plugin! I have a question:
    Is it possible to positioning the image at the top and not to the center, if the image is filled with whitespace because of correct aspect ration? Thanks.

  7. Hello. This may be an odd question but a situation has arisen that has made it such that I must extract/resize the first image in a post then display X number of other images as normal. My first image is being resized no problem but none of the other images show up. Can I override this by chance? Any way of showing the other images untouched?

  8. Ciao Mick, avrei da farti un domandone: è possibile integrare il plugin “NextGen Gallery” con image extractor? Le immagini che vengono caricate su nextgen hanno una cartella di destinazione finale differente (/wp-content/gallery/) rispetto a quella dell’extractor (/mat/thumb/). E’ possibile dargli in pasto anche la cartella gallery?

    • Certo che si può, basta metter mano ad una variabile all’interno del plugin di Image Extractor. Però non conosco così bene NextGen Gallery per poter dirti che vengono caricate anche nella galleria. Ciao!

  9. To lo, ale and anybody else who’s getting the:
    html = “”; $this->html=$htmlcode; return true; } function LoadHTML($filename)

    Try to edit the htmlParser.php file inside imageExtractor dir and check 1st line: if it’s
    change it to:

    This worked for me in my WAMP environment.

    • Thanks. I was getting the code mess at the top of my pages too.
      Running php5.3 and WordPress 3.2

      The problem is that htmlParser.php is not using the current standard <?php opening for php code and the browser is showing the code as html.

      Mick – you should fix this in your source code and issue an update.

      Also, where is the recommend location for the thumb directory? Same as the http document root for our site?

  10. Ah ho risolto, sbagliavo nel cambiare il path delle immagini /math/thumb, ora ho corretto.

  11. Buongiorno, a me viene fuori questo errore

    Warning: imagejpeg() [function.imagejpeg]: Unable to open ‘/www/www/mat/thumb/72×73-foto021-150×150.jpg’ for writing in /www/www/ivan/ivan-wordpress/wp-content/plugins/imageExtractor/class.ImageToolbox.php on line 679

    non sono molto esperto non so che fare

  12. Hi,
    Image extractor is a great plugin but it doesnt currently work for my site.

    What happens is that for my blog template, on each of my posts, i have a bunch custom fields, one of them is called “img” where i put the url of the image i want to be displayed in my post. However Image Extractor doesnt take images in the custom fields in consideration, because they are not actually in the of the post’s wysiwyg “content”.

    The workaround for this is for me to post the image once in the wysiwyg, with a css class that hides the image, and then put the img url again in the “img” custom field that i use for my blog post templates. This is rather annoying and defeat the purpose of this plugin.

    So my question is this, is there a way for Image Extractor to be aware of the images in the post that are inserted with the custom fields ???

  13. Il fix suggerito per evitare il problema di cropping funziona:


    change it to this:


    Grazie, ottimo plugin, gira bene sulla 2.8

  14. sto avendo dei problemi a far girare il plugin su un server windows.
    quando lo attivo mi appare un sacco di codice, faccio fatica a capire qual’è l’errore.

    il codice che mi appare è questo: html = “”; $this->html=$htmlcode; return true; } function LoadHTML($filename) { $this->html = “”; if (!file_exists ($filename)) { //return false; } //$filename=”http://www.dynamick.it”; //echo $filename.””; $fh = @fopen (trim($filename), “r”); if ($fh!=false) { //flock($fh,2); while (!feof ($fh)) { $buffer = fgets($fh, 10240); if ($buffer!=””) { $this->html.=trim($buffer); } } //flock($fh,3); fclose($fh); return true; } else return false; } function GetElements(&$result) { if (count($this->elements)==0) { return false; $result=array(); } $result=$this->elements; return true; } function Parse() { $ignorechar = false; $intag = false; $tagdepth = 0; $line=””; $text=””; $tag=””; if ($this->html==””) { return false;} $raw = split (“\r\n”, $this->html); while (list($key, $line) = each ($raw)) { $htmlline = htmlentities($line); if ($line==””) { continue; } $line = trim($line); for ($charsindex=0;$charsindex<=strlen($line);$charsindex++) { if ($ignorechar==true) { $ignorechar=false;} if (($line[$charsindex]=="elements[]=$text; $text=””; } $intag = true; } else if (($line[$charsindex]==”>”) && ($intag)) { $tag .=”>”; /* Tag Found */ $this->elements[]=$tag; $ignorechar = true; $intag=false; $tag=””; } if ((!$ignorechar) && (!$intag)) { $text .= $line[$charsindex]; } else if ((!$ignorechar) && ($intag)) { $tag .= $line[$charsindex]; } } } return true; } function download($file_source, $file_target) { $rh = @fopen($file_source, ‘rb’); $wh = fopen($file_target, ‘wb’); if ($rh===false || $wh===false) { return true; } while (!feof($rh)) { if (fwrite($wh, fread($rh, 1024)) === FALSE) { echo ‘Download error: Cannot write to file (‘.$file_target.’)’; return true; } } fclose($rh); fclose($wh); return false; } function getAttributes($html) { //preg_match_all(‘/(\w+\s*=\s*”[^”]*”)*|(\w+\s*=\s*\'[^\’]*\’)*/’,$html,$attr); $attrWithDblQuote='((\w+)\s*=\s*”([^”]*)”)*’; $attrWithQuote='((\w+)\s*=\s*\'([^\’]*)\’)*’; $attrWithoutQuote='((\w+)\s*=(\w))*’; preg_match_all(‘/’.$attrWithDblQuote.’|’.$attrWithQuote.’|’.$attrWithoutQuote.’/’,$html,$attr); //echo “#

    “;print_r($attr);echo ”

    “; if (is_array($attr)) foreach ($attr as $count=>$attrArr) { if (is_array($attrArr)) foreach ($attrArr as $i=>$a) { if ($a!=”” and $count==2) $res[$a]=$attr[3][$i]; if ($a!=”” and $count==5) $res[$a]=$attr[6][$i]; if ($a!=”” and $count==8) $res[$a]=$attr[9][$i]; } } return $res; } function linkAnalyzer($url) { $regexp = “(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?”; $regexp = “(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?”; eregi($regexp,$url,$ret); $r[“url”]=$url; $r[“scheme”]=$ret[2]; $r[“authority”]=$ret[4]; $r[“path”]=$ret[5]; $r[“query”]=$ret[7]; $r[“fragment”]=$ret[9]; return $r; } function getTagResource($tag=”a”) { global $elements; $tag=”elements)){ if (strtolower(substr($code,0,strlen($tag)))==$tag) { $attribArr[]=$this->getAttributes($code); } } return $attribArr; } function includeImportCss($html,$path=””,$level=1) { global $urlToGrabArr; preg_match_all(‘/@import\s[\”]*((http:\/\/[^\/]*){0,1}(.*?))[\”]{0,1};/i’, $html,$result); //echo ”

    “;print_r($result);echo ”

    “;die; if (is_array($result[3])) foreach ($result[3] as $k=>$v) { $url=dirname($path).”/”.$result[3][$k]; //echo “url ricavato: $url
    “; if ($this->url_exists($url)) { $css=@file_get_contents($url); //die ($css); $html=preg_replace(‘/@import\s[\”]*((http:\/\/[^\/]*){0,1}(.*?))[\”]{0,1};/i’, $css, $html); //if (strstr($html,”@import”)) $html=importCss($html,dirname($result[3][$k]),$level++); } } return $html; } function url_exists($url) { $handle = @fopen($url, “r”); if ($handle === false) return false; fclose($handle); return true; } } ?>

  15. hi

    i am getting below error once i activate plugin

    Fatal error: Class ‘htmlparser’ not found in D:\training\wamp\www\wordpress\wp-content\plugins\image-extractor\imageExtractor\imageExtractor.php on line 91

    please help me out how to solve this issue

  16. For anyone having the problem of no images showing up, here is a possible solution (works on Mosso.com cloud hosting with WordPress 2.7.1)

    Edit the file: imageExtractor.php
    Find all instances of: getenv(“DOCUMENT_ROOT”)
    and replace with: $_SERVER[“PHP_DOCUMENT_ROOT”]

    Apparently on _some hosts_, DOCUMENT_ROOT doesn’t come through as the correct place on the server to put the files, so the plugin fails to create the thumbnails.


  17. Hi,

    Is there a way to override img tag attributes “alt” and “title” with the title of the post which the image is extracted from?


  18. thnx for the plugin but how to make it to resize all images that I post from other sites not uploaded to wordpress… Can I resize that kind of images or not.. Please answer soon because I need it very much

  19. how would i make it get thumbnails from images on my category page?

  20. ciao, mi scuso per l’intrusione ma ho bisogno di aiuto e sono davvero in difficoltà.
    Mi spiego: fino a pochi giorni fa usavo la plugin “alakhnors-post-thumb” ma non so bene per quale motivo ha fatto esplodere il blog, ed è il caso di usare questo termine, visto che ha buttato giù il server aruba per 3 giorni 🙁
    Però tante mi piacerebbe avere nella sidebar sx le iconcine delle foro degli ultimi 10 post con i relativi titoli lincati.
    Cosa posso fare?
    Non posso permettermi di buttare di nuovo giù il server aruba, hanno minacciato di sospendere il contratto!
    Questa plugin fa al caso mio ed è compatibile con WP 2.7.x?
    grazie con tutto il cuore per tutto l’aiuto che riuscirai a darmi

  21. Hey, nice plugin. But I’m confused as to how to implement this on my blog.
    I’m using the livewire theme. Can you help me out?

  22. Thanks a lot for the plugin. It modified my blog nicely.
    However, you need to modify details of your plugin on wordpress site as it has the wrong syntax. imageextractor rather then image_extractor.



  23. I had a similar problem where resized images weren’t working, the thumbnail wasn’t being created in the cache file, when I moved hosting. I finally tracked down the problem to the plugin using DOCUMENT_ROOT which was giving the wrong result, I changed it to use PHP_DOCUMENT_ROOT and it all works fine again. Hope this info may help someone else having problems.

  24. I had the same problem as Lindsey and a few others here when using the wonderful Image Extractor plugin on a WordPress site in a subfolder.

    When entering your path in the imageExtractor.php, make sure you add the subfolder path in the beginning. For example for a site: http://www.mysite.com/subfolder and thumb-folder with correct permissions at wp-content/thumb it is:


    Works perfectly.

  25. Question:

    I’m using the plugin on a testing subdomain and when I set the first attribute to “true” none of my images will show. But when I change to false, all the images immediately show, although since I have them set to resize they are becoming a bit distorted.

    I do indeed have the gd2 graphics plugin for PHP. I double checked with my host this evening.

    Funny thing is, I’m using same plugin on the root domain of another site (hosted on same host) and it works fine when set to “true”.

    Any suggestions?

  26. Ciao, ho lo stesso problema di Io, c’è qualche soluzione a riguardo? Mi serverebbe veramente molto questo plugin….
    Grazie per l’aiuto …

  27. Hi,

    I would love to use this plugin but when I try to activate it (wordpress 2.5) it generates an error:

    html = “”; $this->html=$htmlcode; return true; } function LoadHTML($filename) ……………..

    any ideas what may be wrong? I have looked everywhere for a solution but havent found an answer… your help would be much appreciated


  28. hello

    I’m having some trouble setting the cache folder


    what should i have here?


  29. yea, i figured it out.

    @ Jonas Smith: maybe a solution for you too! 😉

    If the pictures are not saved in the original wp-content/upload/ […] folder, image-extractor
    doesn´t work. so, if your image-link in the post is something like “http://www.example.com/image.jpg”, image-extractor although work with “false”, but the crop function is disabled.

    So, make sure, that your images always are linked to your upload folder! 😉

  30. funny. i´ve got the same problem as Jonas Smith.

    Inserting the first image without resize works fine, the second image – if i have the resize option (TRUE) turned on – wont be shown. It will be empty.

    WP 2.6. Any ideas?


  31. i got image extractor to work without having a local location on my server, or using uploaded images. all my images are remotely hosted on photo bucket or imagshack, so basically have a “featured” sidebar with loads of images, clickable to the post itself (usually could only done by using uploaded images and plugins).

    my question is, if you can incorporate this with the “relatest posts with thumbnails” plugin, it would be the best plugin ever. having related articles with thumbnails, WIHOUT having the thumbnails’s source coming from physical uploaded images. but from remote hosted images instead… if i can use “related posts to thumbnails” to call “extract_images()” as the output, it would be great, please show me how.

  32. Hi this is an awsome plugin and i have managed to get it working on my site fine for images that are put up manually into each post. But i was wandering if anyone knew if there was a way of manipulating this plugin so that i can extract images from posts that use a “random Image” plugin, or if there is another plugin out there that does this. If so it would be a great help.


  33. First: Excellent plugin, thanks a lot.

    One one site (WP 2.5.0) it works nicely – but in another site (http://jonassmith.dk/weblog/, WP 2.5.1) thumbs don’t get generated. Inserting the first image without resize works fine, though.

    Anyone know what might be the problem? Can it be related to the lates WP version?

    (Thumb folder is fully writable).


    – Jonas

  34. Ciao, bellissimo plugin ma anche a me non funziona in modalità $resize=true

    Credo che come gli altri amici qui sopra non sia ben chiaro se la path della cache nella configurazione debba essere assoluta a partire dalla root o relativa al template…

    Potresti dirci la path corretta da configurare.

    per il resto è quello che cercavo e per farti felice ti dirò di più: il tuo plugin è risolutivo per il template “Revolution”…

    Grazie ancora…


  35. I found a fix for the black areas that many of us were getting when imageExtractor improerly cropped an image. Open up ‘imageExtractor.php’. go to line 112. it should look like this:


    change it to this:


    Thats it.. fixed it for me!

    Thakns for this great plugin!

  36. Ciao, compliementi per il plugin. Io ho un problema, non riesco a capire perchè quando lo inserisco mi rovina tutta la disposizione del sito.

    Posso collegare il plugin al codice che elenca i post recenti o quelli più letti?

    Grazie Mille


  37. This is a great plugin. Is there anyway to make it work with the new WP2.5 gallery if there is a gallery instead of an image.

  38. Will the “Image Extractor” plug-in be updated to address the issues with incorrect cropping (using resize type 1) and image quality? Sometimes I notice the new images are of great quality.

    Looking forward to the future release!

  39. I want to activate this plugin on localhost (wampserver), but I can not, because it gives error. How to install it?

  40. ciao, il tuo plugin sarebbe per me una mano santa…se solo riuscissi a farlo funzionare! 🙂

    questa è la funzione che scrivo:
    image_extractor(true, 1, 240, 180, ‘post-image’,”, ”, ”);

    ho WP 2.3.2, la cartella per le immagini è abilitata alla scrittura, ho il supporto GD sul server.
    Ma con il true non mi funziona, non mi resiza le immagini e non succede nulla. Se metto false invece funziona, ma non è quello che mi serve, perchè mi stretcha le img.

    Questo è ciò che scrivo nel file di configurazone della dir:

    Quale potrebbe essere il problema?
    Grazie in anticipo per il supporto, ciao

  41. I’m using Resize Type 1 and it’s not working correctly, as described by others. It crops the images incorrectly, leaving big black spaces.

  42. Is it possible to use this plugin to show the image from the previous or next posts? I want to do a previous and next post preview thumbnail on single view pages…


  43. Hi there,

    GREAT plugin! I use it on my own site no problems, but I’m doing a new site for someone else now and I’m getting the same error as abelafonte when I set resize to true:

    Fatal error: Image: Outputwidth and -height must be integers greater zero.

    …but I have them both set to 100

    Also, where do I create the image cache folder? Where is the location /mat/thumb/ relative to?


  44. Great Plugin! How can you make it display a default image if it does not find an image? Thanks!

  45. hi mick,
    I’m currently using wp 2.3.2, when i enable this plugin in my sidebar this error comes out.
    [quote]require_once(dddd.com/wp-content/themes/default/sidebar.php) [function.require-once]: failed to open stream: No such file or directory at dddd.com/wp-includes/theme.php (440)
    timed at 14-Jan-2008 13:26:28

    any idea guys

  46. Ciao Mick,

    C’è un modo per fare si che l’immagine sia un link al post?

    Io ho provato così:

    ', ''); ?>

    Ma la funzione “the_permalink” non funziona (scusa il gioco di parole).

    Hai qualche suggerimento?

    Ciao e grazie.

  47. How can i save the resized image in jpg ? The thumb are too big 🙁 and is there a way to choose where crop ?

  48. When I try to resize, i keep getting the following error in my log:
    PHP Fatal error: Image: Outputwidth and -height must be integers greater zero

  49. x Mick
    I tryed to install Image Extractor, but I failed… =( few strange errors appeared & I just deactivate it. Today I surf your blog & understand all usefulness and power of your plug-in. As soon as I’ll write a tutorial for you about creating headers like mine, I’ll try to install plug-in one more time… because I really need its functionality for dezignus.com, & for my future projects!
    (ps. Sorry for my English, I’am Russian)

  50. X Meerblickzimmer: perhaps the image is too big, and the php exceed the allowed memory.
    X Stanly: My plugin works exactly as you describled. Try it!!!

  51. Hello Mick.
    I’am trying to find plugin or function, to extract an image from post, resize it, & put above the title of post in “Recent Posts” field (in the slidebar).
    Is it possible to do with your script?

  52. Hei! Thanks for your great plugin but i have a problem. It doesn´t resize the image but the GD Support er enabled and the folder has 777. Do you have any idea?


  53. could you tell me how to establish a permalink to PNG image?

    I tried the following syntax, but I couldn’t it.

    $posts = get_posts('numberposts=1&category=6');
    foreach($posts as $post) :
    image_extractor(true, 1, 200, 0,'img_L','','<a href="<?php the_permalink() ?>">','</a>');

    Thanks for this plugin.

  54. could you tell me how to establish a permalink to PNG image?

    I tried the following syntax, but I couldn’t it.

    Thanks for this plugin.

  55. Your plugin sounds great, is it possible to specify one or several categories in the function? Thx!

  56. Problems installing. I am setting the php file to the correct writable folder and am attempting to install. Getting all sorts of errors once i click the “activate” button. Then i have to deactivate immediately or i have an issue with my header in the wp-admin? Anyone else run into this issue?

  57. Like Robert McPeak asked, I also have a need for this sort of plugin. One reads WordPress feeds, pulls the first image out of said feed and displays the image, post title and a link from the post title to the actual post. I probably could mash one up, but if someone already invented this wheel, I’d be interested. Thanks!

  58. I’ve modified you plug in get a parameter that tell him to “echo” or “return” the results.
    this is useful if you wanna use the URL returned in some other php function or variable.
    maybe in the next version u can incorporate that.

  59. Mi spiego meglio, inserendo il tag nel loop del file home.php ( che è poi la pagina iniziale del sito ) compare solo l’header, tutto il resto della pagina è bianca, quindi suppongo che il loop venga bloccato dal tag image_extractor..

  60. Ciao, complimenti per il plug-in !! volevo segnalarti che ho inserito questo codice nell’index.php , dopo aver installato il plug-in, purtroppo però non accade nulla, le GD funzionano correttamente, puoi darmi qualche consiglio ?
    Grazie mille

  61. Hi Rafael or Mick!
    I have the same problem with the cropping method 1. That’s the one I would like to use. But I get these ugly black borders, and the actual image is hardly visible (too narrow). Please send me your updated plugin, I really would like to use it here: http://bentographics.com/site/
    It would be great to have an option, where the plugin should crop, i.e. center of the image, otherwise one ends up with a lot of borders and not much of the actual image or graphic you want to display as thumbnail.
    Please write me, my email is on my website or use bentoenterprises {at} gmail {dot} com. Thank you lots! b

  62. I am not good at php, but I founded and fixed 2 erros I was getting:
    1- The generated code was showing a number one just before src, like this: <img 1 src=”file.png” width=”50″ alt=”” />
    I added a str_replace to take that one out.
    2- The resize method 1 was generating weird images with lots of black spaces (even with the background color was white) and with just a few pixels of the original image. I really do not know the reason for this, but I solved changing the save extension from png24 to jpg.
    It is all working good now, but maybe you can find out the reason why it was acting like that. If it helps, my websites are hosted at BlueHost and the line code was identical to yours in How to Use session. Those were the only code changes I made.

  63. mitico plugin, purtroppo mi produce un errore di validazione xhtml per ogni immagine inserita

  64. Thanks Luke, I’ve updated the Image Extractor project with your tips and I hope many problems could be resolved.
    For those who catch some problems, I suggest to download the new version.

  65. Ottimo plugin!! ma purtroppo mi da un errore durante la validazione.. “”
    a causa dell’ 1 dopo

  66. Hi, when the post don’t have an image, the function image_extractor(…) outputs an img tag like this: and will display an empty image on browser. You need to check if you have an image on the post… Best regards, Cip.

  67. I was also getting this error:
    Warning: Cannot modify header information – headers already sent by (output

    For line 692 of class.ImageToolbox.php so I simply commented it out and everything seems to work fine.

  68. You have a bug if you have a post with no images… it still tries to resize.
    I added this at line 100 of image extractor.php and it seems to have fixed it:
    if ($attribArr==false) return;

  69. Hai ragione. Non ho controllato, ma credo che il controllo manchi. Verifico ti faccio sapere di meglio! Ciao!

  70. Una domanda: ma c’è un check circa la presenza o meno di un’immagine nel post? Perché ho un errore che parrebbe far presumere di no. :p

  71. Hello

    This is a fantastic plugin, I am using it here:

    The only problem is that I am still getting the image shown as part of the original post. How can I only show the text of the post, or is there an equivalent ‘text-extractor’ plugin?

    Basically I would like to be able to show the text and the image of a post independently, and your plugin has helped me get half way there….

  72. giusto, hai ragione. Alla riga 4 c’è il title, che ho commentato con , questa sera provo a toglierla, strana cosa. Scusa la poca dimestichezza, ma la linea 692 non c’è, puoi indicarmi cosa dovrei controllare? Grazie per il supporot 🙂

  73. Ciao Franco,
    sinceramente non saprei darti un aiuto. Dovresti dirmi cosa c’è alla riga 4 di header.php e la riga di codice dove invochi imageExtractor.

  74. Ciao Mick, e complimenti per il plugin. Ho qualche problema nell’installazione: se wordpress è installato nella root, e la cartella cache (777) è /images/thumb qual è il percorso corretto nel file php? /images/thumb/ , giusto?

  75. hi, i am a wordpress noob. can you give me an exampel how to realize a thumb gallery like the portfolio http://www.h4x3d.com/portfolio with your plugin. i have install the plugin but it dosn’t work (i think it is my loop?)
    thanx patze

  76. For Yas V: Image Extractor works only for local images.
    For Jason: I’ve tested Image Extractor on WordPress 2.1.3 and it works fine. I suppose your problem is related to bad image formats. Check if your images are a standard jpg, gif or png.

  77. I keep getting this error any help would be great.

    Warning: getimagesize() [function.getimagesize]: Read error! in /home/spllogic/public_html/ctk/wp-content/plugins/imageextractor/imageExtractor.php on line 104

  78. I would like to do this:

    (your code here)

    but it does not work.
    what is the right function?

  79. This plugin is awesome does what I needed. Although I notice when images are posted from an external site such as image shack the image isn’t extracted. Is it something I’m doing wrong ?

  80. Hi Rafael,
    I suppose your problem is due to the missing of the gd2 graphic library extension from the php ini file of your hosting server. You can check it by creating a file with this line inside: < ? phpinfo(); ?> and verify the GD2 is loaded in the php extensions.
    I hope this can help you.

  81. Problems… I installed the plugin at my website, but everytime I set ‘true’ to ‘resize’, no image is loaded. If I set to ‘false’, it works fine. I changed the folder variable to the same folder I upload my images with wordpress, but it still does not work.
    I am pretty sure the problem is with the hosting company, but I do not know exactly WHAT should I ask them to change. Any clue?

  82. ok thank tou for your help I’ll try to fix it
    in this way,

  83. For Opocaj: um…I suppose this new problem could be related to the image size. If the image is too big, the resizing may fail. Resolve this problem manually: delete the broken image from the cache folder (/opobl/thumb/thumb395x100-CHRYSLERsmall.png), and regenerate it by refreshing the page.

  84. hey. I figured out the problem I was having, it was a php problem, nothing to do with your plugin. Cheers – A.

  85. Tank you very much for your patience,now it’s work!
    Just one more thing:
    I’ve tried it with some different size’s images
    using resize_type “1”.
    mostly it’s works fine but sometimes(maybe with big images) it starts to crop from the bottom or puts a black portion ,as you can see here: http://www.opocaj.it/opobl/
    Maybe i’m wrong, but It could be better if it starts cropping from the center of the image.
    I hope this last post will be usefull also for you,

  86. eheh… you’ve to add the php tag (< ? and ?>) before and after any php statements. So, the result is:
    < ? echo image_extractor(..); ?>
    where the “…” are the function parameters. Hope this can definitely resolve your problem.

  87. nothing..
    the php.ini seems to be ok.
    i’ ve tried with echo but it doesn’t works
    as you can see here: http://www.opocaj.it/opobl/
    here you can also see 2 posts with the code i’m using and an extract from my php.ini.

  88. Ok Opocaj,
    you have to write “echo image_extractor(..);”. If it not works, check you’ve php_gd2.so enabled in your php.ini.

  89. sorry,I’m sure your plugin works fine,maybe the problem is my knoledge of php.
    this is what i’ve done:
    1-in imageExtractor.php i’ve only changed the line with the ‘destination dir’ nothing else.

    2-I’ve put your code in this way:

    image_extractor(true, 1, 395, 0, ‘’, ‘’, ‘’, ‘’);


    but ,when i look at the blog it doesn’t work and appear :
    image_extractor(true, 1, 395, 0, ‘’, ‘’, ‘’, ‘’);
    before the post.

    what’s wrong?

  90. Hi Opocaj,
    I’ve checked my plugin, but it seems to work. Can you detail more exactly what kind of problem you have?

  91. sorry ,but i’m new to php,i’ve tried to put the code inside the loop but always get sintaz error .Can u please write me how exatly the code would be?
    this is my index.php:


    Filed by on under || “>

    thanks so much,

  92. Hi Opocaj,
    the “image extractor” plugin works inside “The Loop” of WordPress. Bring your template/index.php and inside the “while” loop that cycles between the posts, you can use the image_extractor plugin. Hope this can help you,

  93. Ciao Mick,non riesco proprio a far funzionare il tuo plugin.in “How to use” hai riportato una parte di codice:Bisogna inserirla manualmente nel Main Index.php?o magari nel single post?
    grazie j.

  94. Great Plugin. I got everything working, but after the thumb is created, it’s permissions are 644, so it doesn’t get displayed. Once I manually change the permissions, it shows perfectly — how can I solve this? (the thumb directly is set to 777)

  95. Hi Gabu,
    you’re right. I’ve forgot to notice that the plugin needs the GD extension.
    You’ve to enable the php_gd2.so (or php_gd2.dll) inside your php.ini.

  96. Hello!
    I’ve instaled your plugin and uploaded a ‘.jpg’ image to test it. I got the following message while the image wont show: “Fatal error: Image: Imagetype (jpg) not supported for reading. in d:\arquivos de programas\easyphp1-8\www\wp-content\plugins\imageExtractor\class.ImageToolbox.php on line 461”
    Do you have a hint of the problem?

    Thank you very much!

  97. Hi again, I downloaded the new version, activated it, and I got the error “headers already sent” in class.ImageToolbox.php. I noted that the closing “?>” tag at the end of the code was missing, I added it, and everything goes fine! 🙂
    Thanks a lot!

  98. Hello.
    I didn’t get exactly where to ad the code. I’m using the cutline theme, and here is code. Can you show me where to insert the code ? Thanks !!

  99. To Sergio: Thanks for your bug hunting. The problem is now resolved thanks to you.

    To Matthieu: Woww… thanks a lot for your review in the WordPress France blog.

  100. Hi Mick, I’m using WordPress 2.1.2, and when I activated and used the plugin, I got the following error message in my site:

    Fatal error: Call to undefined function: get_the_excerpt_reloaded() in /public_html/wp-content/plugins/imageExtractor/imageExtractor.php on line 64

    What should I do?
    Thanks a lot,

  101. To Srijit: You can specify % if the resize option is turned off. In case you have enable the resize=true you have to specify the exact pixels width or height or both.

  102. All right Mick, I’ll try to adapt Image Extractor for WPMU and I’ll let you know.
    Thks again for sharing

  103. To Matthieu (2): I’m sorry, but I don’t know WPMU. If you are able to adapt Image Extrator to WPMU, tell me how, and I’ll modify it in the SVN repo.

  104. To Matthieu: in your template folder, open index.php. Walking inside the code, you’ll find the while that loop through the posts:

      while (have_posts()) : the_post();

    Inside that loop, you can use a lot of predefined template function, such as the_excerpt(), the_post(), the_title(), etc… Installing Image Extractor, you’ll able to use a new template function: image_extractor(true, 1, 395, 0, ‘’, ‘’, ‘’, ‘’); It’s very simple and I think the plugin doen’t need more documentation. I hope this is enought. If you have any other doubts, don’t esitate to ask me. Cheers, Mikc

  105. I’ve been waiting for a plugin like for a *long* time. Thanks for sharing.

    What would be tremendous is to push the plugin in WPMU playground. It would be really usefull combined with “display last 10 posts from all platform” plugins.

    I am actually working on a wpmu platform for radio in paris. Check out my “sand box”.

    If you want to play with me with your plugin let me know and we’ll talk about that.

    Thanks again


  106. This looks really cool. When you have time you should put some help documentation for dummies (like me). I couldn’t get this working without errors. I’ll check back later.

  107. per funzionare, funziona. ma non riesco ad adattarlo nel plug-in che serve a me, ovvero random posts. magari lo uso in altro modo, appena mi viene in mente come. ottimo lavoro, in ogni caso!


  108. Bravo: ora lo provo subito. Pensa che proprio la scorsa settimana stavo cercando un plugin simile. Grande! 🙂

  109. eccezionale! lo cercavo da un sacco di tempo un plug-in di questo tipo. e tu lo hai creato proprio come serviva a me! 🙂

    questo pomeriggio mi metto subito a provarlo e poi ti faccio sapere cosa ne penso!



I commenti sono chiusi.


  • Mahesh Ruparel Aprile 2, 2007

    […] ————————- often people just want to remove the first image in a post, with the above script, this is how. <?php ob_start(); the_content(‘Read the full post’,true); $postOutput = preg_replace(‘/]+./’,”, ob_get_contents(),1); ob_end_clean(); echo $postOutput; ?> —————————– <?php            $beforeEachImage = “<div>”;            $afterEachImage = “</div>”;            preg_match_all(“/(<img [^>]*>)/”,get_the_content(),$matches,PREG_PATTERN_ORDER);            for( $i=0; isset($matches[1]) && $i < count($matches[1]); $i++ ) {                  echo $beforeEachImage . $matches[1][$i] . $afterEachImage;            } ?> ——— http://www.dynamick.it/image-extractor-765.html […]

  • Image Extractor Plugin « WordPress Italy Forum Aprile 2, 2007

    […] sono nuova. Ho recentemente installato la versione 2.2 di wordpress. Ho qualche problema con questo plugin Ho provato ad inserire il codice nel template di default, nel file index.php, ma mi è risultato […]

  • - Blographik - Grafica, web Design e video editing Aprile 2, 2007

    posizionamento degli annunci di google è stata molto oculata, ha seguito in dettaglio la mappa termica che google stesso mette a disposizione per migliorare i propri introiti tramite la loro pubblicità. Da segnalare Image Extractor, l’utile plug in per wordpress realizzato da Michele Gobbi per dare maggiore rilievo alle immagini in quanto vengono estratte e ridimensionate a seconda delle proprie esigenze. Nella home di dynamik.it le immagini sono di piccole dimensioni, per

  • WordPress Francophone Aprile 2, 2007

    simple à prendre en main que les utilisateurs finaux vont *vraiment* utiliser qu’un workflow brutal comme celui de typo3 que l’on débranche 2 semaines après la mise en production parce que personne n’y comprend rien. ImageExtractor : (page plugin) [IMG ] Le plugin dont j’ai rêvé pendant un moment. Il permet de filtrer le contenu d’un post et d’en sortir la première image trouvée. Très utile pour faire des remontées de catégories en teasing sur votre page d

  • Labpress - Um site WordPress sobre WordPress Aprile 2, 2007

    Tools Combining Google Maps and Geotagged Photos” Dreamweaver Extension for WordPress (por Vikiwords) Extensão para o Dreamweaver que pode otimiza (muito) o trabalho na construção de Temas para o WordPress.WP Image Extractor PluginUm bom plugin para quem pensa em fazer do WordPress, o seu CMS. O Image Extractor Plugin promete automatizar uma tarefa só era possível com o uso dos custon-fieds. Ele pega a primeira imagem de seu post, redimenciona, guarda e exibe em sua

  • Labpress - Um site WordPress sobre WordPress Aprile 2, 2007

    Tools Combining Google Maps and Geotagged Photos” Dreamweaver Extension for WordPress (por Vikiwords) Extensão para o Dreamweaver que pode otimiza (muito) o trabalho na construção de Temas para o WordPress.WP Image Extractor PluginUm bom plugin para quem pensa em fazer do WordPress, o seu CMS. O Image Extractor Plugin promete automatizar uma tarefa só era possível com o uso dos custon-fieds. Ele pega a primeira imagem de seu post, redimenciona, guarda e exibe em sua

  • WordPress Plugin Database Aprile 2, 2007

    retrieved from the first image found in the current post. The “Image Extractor” main feature is the capability to resize the image found to a wanted size. The final image is cached in a folder, so you can obtain better performances. [Download] [Plugin Page]

  • Free Treasures for Designers Aprile 2, 2007

    you. Today it is personal blog of Italian web observer and programmer – Mike. If you don’t understand Italian you can use Google Language Tools (as I did). About a month ago I started to communicate with him about his wonderful Word Press plugin -Image Extractor(it can extract the first image from the post and display it). I’m sure this plugin has a great potential and someday I will install it to my blog, The next great thing is his new WP Plugin Related Post with Thumbnail