[header]resize

WordPress Plugin: Resize at Upload Plus

By Daniel, 6. Januar 2009

I’m turning off comments due to the amount of spam. Also, I’m no longer supporting this plugin. Time to move on.

Okay, es ist nicht wirklich ein “neues” Plugin, eher eine Verbesserung eines sehr einfachen aber dennoch sehr sinnvollem und nützlichen Plugin namens  Resize at Upload. Dieses Plugin verkleinert automatisch Bilder, die hochgeladen werden, falls diese einen Maximalwert übeschreiten. Dies ist besonders praktisch, falls ein Kunde seine 25 Megapixel Bilder hochlädt und sich dann wundert, warum das Layout zerschossen ist ;)

Nachdem mir eine Option der Höhenregulierung fehlte, und Anton sein Plugin weiterhin einfach und leicht halten wollte, habe ich es einfach selbst hinzugefügt. Und ich mich gerne in Ruhm und Ehre bade, schreibe ich darüber :)

Okay, actually it’s not a new plugin, it’s just an improvement of a really neat and simple plugin called Resize at Upload. This plugin will automatically resize images that are too large when they’re uploaded – if your client choses to directly import his 25 megapixel photos ;)Resize at Upload will reduce the dimensions to those that you set. This will conserve webspace and keep your layout nice and tidy.

Since I missed an option to also set a max height, I simply added it to Anton’s plugin. And since I’m hungry for fame, I post about it :)


Meine Modifizierung hier herunterladen

Die Anwendung ist simpel:

  1. Meine Version des Plugins herunterladen
  2. unzippen
  3. In das yoursite/wp-content/plugins Verzeichnis hochladen
  4. aktivieren
  5. Einstellungen checken und anpassen.

Dann

  1. Hierher zurückkehren und einen Kommentar hinterlassen, wie toll meine Modifikation doch ist
  2. Zu Anton’s Seite surfen und auch ihm danken, dass er das Plugin erdacht, programmiert und verbreitet hat.

Spenden

Sollte dieses Plugin Euch Freude bereiten, oder einProjekt vereinfachen / ermöglichen, oder einen Kunden zufriedenzustellen, so würde ich mich über eine Spende freuen. Ich werde 50% aller Eingänge mit Anton teilen, da sein Plugin die Basis von meinem ist.

Download my modification here

Usage is simple:

  1. Download the my version of the plugin
  2. unzip
  3. upload to yoursite/wp-content/plugins directory
  4. activate
  5. check the settings and adapt to your needs.

Then

  1. come back here and post a comment about how cool this plugin is
  2. go to Anton’s site and thank him for doing the heavy lifting and coming up with a splendid plugin like this

Donate

Should this plugin prove useful by either simplifying your blog, or maybe even please your customer I would appreciate it if you would donate whatever you deem appropriate. I’ll share it with Anton.

37 Comments

  1. Matt sagt:

    I have your plugin and it looks like a great plugin. I’m going to help with a donation. I’m wondering how I can tweak it. I am working on a photoblog network and using the Monotone WordPress theme. It works by by scaling photos to a maximum 840 pixels wide and a minimum width of 560. It somehow does this and renders the photos a good size for horizontal and vertical photos. I wanted to somehow do this at the upload an save myself considerable space on my server. Considering everyone on the network will have a photoblog, it’s important to somehow limit the upload post size properly.

    How would I add a minimum width to the plugin you made?

    Thanks for this opportunity to talk with you on this. I look forward to talking with you soon on this. If you needed a certain amount let me.

    It would be better to have this actually part of the default upload process instead of a plugin, but a plugin would be good enough until I could actually pay someone to code it into the upload process.

    I am using WordPress MU with Monotone theme.

  2. daniel sagt:

    Hmm, I must admit I have never ever touched WordPress MU.

    But I see what the monotone theme does – it makes the image span from border to border (pretty much like my theme here :) ). To prevent the image from being to thin, it resizes an image to a minimum of 560px.

    Since it makes no sense to enlarge an image on upload, I would pretty much ignore this min-width setting and instead instruct my users to make sure they upload images that are “big enought”, like at least 500k. (Some people have no idea what pixels are and instead select “small” and “large” images based on filesize).

    Then set up this plugin to simply limit the width to a max of 840px. This will then save your webspace, traffic etc.
    Actually, you do not need this plugin since the height is irrelevant for you – go to Anton’s site and download the original “Resize at upload” Plugin.

    I actually got an Idea for an extension of this plugin … a “Are you sure you want to upload this teensy weensy image” Notification if a user decides to upload a miniature image :)

  3. ryan sagt:

    I’m also running wordpress multi and would like to use it. I tried to activate it sitewide and it didn’t work. maybe I can call your plugin from the upload php file?

  4. admin sagt:

    It won’t resize images that are already on the site. Only works for newly uploaded images.

  5. Hi there,

    i am using your plugin but have run into a problem. If i upload a file over 2m. I am on a shared server, without access to a Php.ini. I can create a custom one. Can you tell me where to put it for this plugin to work.

    many thanks

  6. yemoonyah sagt:

    Hallo

    Erstmal danke fuer dieses plugin! Es ist sehr wichtig fuer meinen Blog da ich viele Bildr zeige und es spart mir einen Haufen Arbeit!

    habe dein plugin installiert und bis jetzt war alles wunderbar. Aber jetzt bekomme ich diese Fehlermeldung:

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 14592 bytes) in /home4/public_html/wp-content/plugins/resize-at-upload-plus/class.resize.php on line 179

    Ich habe auf line 179 nachgesehen aber da steht nicht von memory size

    Was kann ich tun?

    Danke und Gruss aus Berlin

  7. admin sagt:

    @yemoonah: Danke für die Blumen :)
    Das mit dem Speicherproblem ist eine Einstellungssache des Servers. Entweder Du hast Zugriff auf eine php.ini, oder Du gehst in die Webspace-Admin-Oberfläche, die die meisten Webhosts anbieten, und erhöhst den verfügbaren Speicher für PHP.
    Wenn Du keine php.ini findest, und auch keine Möglichkeit in der Webkonfiguration findest musst Du Dich an Deinen Webhost wenden. Die meisten, mit denen ich zu tun hatte, sind da sehr zuvorkomment und erhöhen den PHP Speicher ohne Probleme.

  8. admin sagt:

    @tag party: Unfortunately this will not work.
    The php.ini is not located in your webspace, it’s somewhere inside the server’s main file system, so creating your own php.ini will not help you.
    You need to go into your webspace admin area (usually the place where you add/remove subdomains, or add/remove other domains, manage your databases etc.) and find the option for php memory. If you can’t find that, ask your webhost to up the available memory for php.

  9. ownong sagt:

    thanks a lot for this plugin
    tried some css editing but the height is usually “unscaled”

    Your plugin really did the job!

  10. Thomas sagt:

    Your plugin is really great but due to some trouble with php memory_limit, I change the resizing code in _resize by

    $cmd = ‘convert ‘.$strOriginalImagePath.’ -resize ‘.$numWidth.’x’.$numHeight.’ ‘.strResizedImagePath;
    $res = shell_exec($cmd);

    it could be interesting to add it definitivly by adding an option in the administration part.

    Thomas

  11. Nathan Wells sagt:

    Is there a way to re-size images that have already been uploaded?

  12. Daniel sagt:

    Not with my plugin, but there is an excellent tool called “scissors” that’ll let you resize and crop your images. One by one, though. No way to batch-resize. In that case I’d download the images via FTP, then resize with a program on your computer, then re-upload.

  13. reidlos sagt:

    You show this screen “Resize at upload Options” everywhere, but I can’t find it anywhere. When I click Edit next to the plugin it just sends me to the place where you can edit the PHP files. How do I get the GUI settings page like you have?

  14. Daniel sagt:

    You need to click on “settings” in your dashboard. Right where you would change your blog title, your permalinks etc there will be a new option called “Resize At Upload Plus”.

  15. Nathan sagt:

    Hi,

    Does this work on all uploaded images? I’m using photosmash and simple press forum, these images don’t get saved to the upload folder in wp-content.

    Thanks

  16. Daniel sagt:

    All this plugin does is display all the images that are attached to a post or a Page.
    What this means is you need to upload the image by using the upload-media button when EDITING the post or Page. Only by doing that will the image actually be a child of the post – and show up using easypermgals.
    The actual location of the files doesn’t matter.

  17. Nathan sagt:

    That’s what I thought. Unfortunately it is the forum users that I’m most worried about! I’m guessing that it wouldn’t be an easy hack to change this.

    I’ve still got it turned on though. This is a great plugin, especially where there are lots of authors (or even one or two non IT-literate ones!)

    Thanks again.

  18. Daniel sagt:

    To be honest, I didn’t even know it worked in Simple:Press forum.
    Let me see if there are ways I can make the plugin stop working inside of forum posts.

  19. Ovidiu sagt:

    hi, sag mal hast du das Plugin mit der neuesten WP Version getestet?
    Ich habe jahrelang scissors benutzt, aber die Funktion ist seit wp 2.9 eingebaut, daher funktioniert das Plugin nicht mehr. Dummerweise haben die Wp Jungs das automatische resizen beim Upload weggelassen :-(

  20. Daniel sagt:

    Nein, noch nicht probiert. Habe aber schon eine Mitteilung von einem User bekommen, dass es nicht mehr funktioniert, ebenso wie Scissors nicht.
    Ehrlich gesagt weiss ich nicht, ob ich das Plugin noch updaten soll, da es bei heutigen Gigapixelkamerafotos meist zu PHP memory Fehlern kommt und dann der eigentliche Sinn des Plugins nicht mehr gegeben ist weil man sowieso vor dem Upload resizen muss.
    Muss mich mal wieder damit beschäftigen.

  21. Niska sagt:

    Hi and thanks for a great plugin! Your plugin doesn’t seem to work when uploading images using WordPress for iPhone. Maby you could add this to a future update?

  22. Daniel sagt:

    I guess that’s because WordPress for iPhone is an app and doesn’t use the php files that are on your webserver. Not much I can do there, I’m afraid!

  23. Richard sagt:

    Hello! thanks for this plugin, really great to resize the pictures on the fly!.. I haven`t noticed before, but the pictures seems a bit “blurry” after resize.. is there a sharpen feature I dont know about?

  24. Daniel sagt:

    Sorry, no. There is no web-photoshop available :)
    If you know about sharpening after resizing, you probably want to resize your images manually and export individually.

  25. Wyn James sagt:

    Great plugin, but it only seems to work for users with full admin rights. When users with editor rights try and upload images various problems occur (including memory limit issues). Is there the possibility of adding an option for editors to add images with this plugin enabled?

  26. petrenko sagt:

    Great plugin! It saved tons of web space on blogs, where authors make square eyes if you ask them to upload normal sized pictures, not terapixel size :)

    But, you understand, that normal people are not coming just to say “thanks” ;)

    Weird thing happened to me today. I installed your plugin on new web host and it is working. It uploads images to wp-content/uploads folder with proper resize.

    BUT. If I move my media folder to other folder (I use “medialib” in the root of my server) – plugin does all well except file access rights – it is 640 (Owner – RW-, Group – R–, Public – — (none))

    Is it possible to hardcode access rights?

  27. petrenko sagt:

    Solved. And this is not problem of the Plugin. Default WP uploader did the same.

    When “medialib” is initially created, you need to set 777 (RWXRWXRWX) for this folder and the rest of subfolders and files would be created with proper rights.

    If you created your upload folder in default location (wp-content/uploads) – no errors/incorrect rights at all.

    One more time – thanks for great plugin.

  28. Daniel sagt:

    Thanks for the kind words, and thank you for the follow-up.

    The only thing that prevents my plugin from being truly kick-ass is server memory limits.
    It won’t work if a user uploads a gigapixel image since php won’t be able to work with it. Ideal would be a solution like with facebook, where a little Java applet does the resizing on the user’s machine BEFORE then uploading it. Saves not only serverspace but bandwidth and upload times too!

    But … that’s out of my leage :)

  29. Wyn James sagt:

    Great plugin – but I’ve been having similar problems to those reported above with the memory limit being exceeded. Mine is set to 64Mb, and this results in error messages for images much greater than 3Mb. However, there is a simple solution – use Scissors v2.9 instead. This happily crunches images of over 6.5Mb. I haven’t yet found an upper limit.

    Perhaps Resize at Upload Plus needs to be pensioned off, with Scissors taking its place? Thanks again for your excellent work on both plugins.

  30. Daniel sagt:

    Yeah, it’s gotten almost useless since WordPress has similar options available in the media settings AND scissors adding an awesome cropping feature.
    I haven’t touched the code in a while and I think it is safe to say that I will not continue with it.
    Thanks for letting me know you enjoyed my plugin while it lasted :)

  31. petrenko sagt:

    The main problem with scissors – you will never guess it has resize at upload :)

  32. Joost mag het weten sagt:

    Does the image get stretched in or out?

  33. Daniel sagt:

    It reduces the size proportionally. No stretching and no up-scaling. That would be stupid :)

  34. thomas sagt:

    hallo,
    Keine Ahnung ob dich noch ein bischen um diese Plugin bemühst, was im Übrigen immer noch sehr nützlich ist, wenn es darum geht keine großen Bildformate erst auf dem Server abzulegen und dann erst zu beschneiden a la Scissors bzw. die WP eingene Funktion.

    Jedenfalls ist das Plug immer noch sehr nützlich!!!

    Allerdings wirft es beim debuggen eine Fehlermeldung aus:

    Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.

    Bin leider selber nicht in der Lage das Plug entsprechend umzuschreiben.

    Nun ja….vielleicht schaffst du das ja???

    wäre sehr schön
    liebe grüße
    thomas

  35. Daniel sagt:

    Sorry for not supporting this plugin, I thought it was dead and only now realized it’s being downloaded regularly still.

    thomas&hellip, the error is being adressed and the new version is being uploaded at the moment.

    Remember that if you actually use this plugin regularly and find it saves some time and effort in your blogging actions, please donate a beer or two.

  36. mark shirley sagt:

    I have instaled on a child of twentytwelve theme. I have tried to update a 4000px wide image but it doesnt resize or allow me to upload the image.

  37. Daniel sagt:

    You are limited to what your server can handle, since the resizing is done AFTER uploading.