Git Product home page Git Product logo

wpthumb's Introduction

This project is unmaintained.

WP Thumb
An on-demand image generation replacement for WordPress' image resizing.
Build status
A Human Made project.

WP Thumb is a simple but powerful plugin that seamlessly intergrates with the Core WordPress image handling. You specify height, width and crop values and an image will be generated and cached for future use.

  • Automatic dynamic images resizing, cropping and caching.
  • Ideal for when you want to change the dimensions of default image sizes.
  • Can extend using filters to make use of any of the phpThumb Library functions by manipulating the image object.
  • Integrate with Imgix & S3 via the WP Thumb Bridge

Installation

Just install like any other WordPress plugin.

License

WP Thumb is licensed under the GPLv2 or later.

Credits

Created by Human Made for high volume and large-scale sites, such as Happytables. We run WP Thumb on sites with millions of monthly page views, thousands of sites and terabytes of images.

Written and maintained by Joe Hoyle. Thanks to all our contributors.

Interested in joining in on the fun? Join us, and become human!

wpthumb's People

Contributors

benhuson avatar chrisrolfe198 avatar danielbachhuber avatar japh avatar joehoyle avatar mattheu avatar richardswain avatar rpetersn avatar tcrsavage avatar willmot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wpthumb's Issues

Use relative path when generating cache filename

Just wondering what you think about this @joehoyle

The filename is generated using the Args and the file path.

If you move the site to a new server, the file path will probably be different.

This is an issue for inline images added to the post content if the cache folder is not moved - as the new image will have a different filename.

Not really sure if this is a bug as such, and inline images will always cause problems as they would not cause WPthumb to regenerate the thumbnail anyway so we are always reliant on the cache folder but I just thought I would mention it as it doesn't seem ideal.

3.3 issue?

Getting this on 3.3-beta1-18972.

Fatal error: Call to undefined function add_filter() in C:\ .... \WPThumb\wpthumb.php on line 387

0.8.2 not working for me

Looks like maybe phpthumb changed something?

This is what I get on /wp-admin/upload.php

Fatal error: Call-time pass-by-reference has been removed in /[path]/wp-content/themes/[theme]/lib/wp-thumb/phpthumb/src/thumb_plugins/backgroundFill.php on line 34

And a notice on the same page

Notice: Array to string conversion in /[path]/wp-content/themes/[theme]/lib/wp-thumb/wpthumb.php on line 743

Going with 0.8 for now...

can't delete image in gallery

Fatal error: Call to undefined function wpthumb_calculate_image_cache_dir() in /home/tal7814/domains/websystems.co.il/public_html/bino/wp-content/plugins/wp-thumb/wpthumb.php on line 648

Document how to include WP Thumb in Themes

We should document how one goes about including WP Thumb in a theme instead of as a plugin.

Here's the code:

if ( ! class_exists( 'WP_Thumb' ) ) {
    define( 'WP_THUMB_PATH', trailingslashit( STYLESHEETPATH . '/lib/WPThumb' ) );
    define( 'WP_THUMB_URL', trailingslashit( get_stylesheet_directory_uri() . '/lib/WPThumb' ) );
    require_once( 'lib/WPThumb/wpthumb.php' );
}

Unable to upload a featured image after including class

I cannot upload a featured image into a post with my plugin (which calls WP Thumb) active.

Here's the code in my plugin:

/* Load WPThumb */
if ( ! class_exists( 'WP_Thumb' ) ) { 
    require_once ( WPRSS_ET_INC . 'WPThumb/wpthumb.php' );    
}

When the add media window opens, no media previously uploaded is shown, and an attempt to upload any image from local will result in this error:

Error wpb logo.jpeg
An error occurred in the upload. Please try again later.

Default image size

Would it be a bad idea to check if there's any default thumbnail size set? Part of why I wanted to use wp thumb was that it kept my filesystem less cluttered with loads of image files I'd never use.. So when I upload a image now, it doesn't create the default xxx-150x150.jpg, the point was to leave it for the cache.

But now, atleast in wp 3.5, I get fatal errors. Don't know if the problem existed in 3.4.*

Show a warning in the admin if cache dir is not writabe

It's often difficult to tell why WP Thumb is not working. We should do a writable / exists check on /cache/ and show a yellow message in the admin if something is not right. Seems ok to show it on every admin page, as it's high priority,

cache folder size exploding

I was previously using https://github.com/drrobotnik/vt-resize for any custom image crops. It worked well, but as of 3.5 has deprecated code. I'd really like to use WPThumb and thought I understood it. I've created a featured post widget that shows 5 posts and it looks like wpthumb is working correctly for it and this is the only place I've explicitly called the function.

But I'm building a photographer site and my cache folder for 2013/03 is over 30 mb and it looks like it's caching photos on the site I haven't touched. Does this plugin cache all images by default when viewed?

Notice when deleting items from media library in 3.5

This may be already known and fixed in the rewrite, but thought I'd note it.

When deleting items from the media library in WP 3.5, the following notice is given:

Notice: Undefined offset: 1 in /wp-content/plugins/wp-thumb/wpthumb.php on line 91

Problems with default image

Hi guys!

What is wrong in this code:

$default, 'width' => 870, 'height' => 370, 'crop' => 1 ) ); ?>

The default image is not working...

Thanks!

Gallery Links

When you create a gallery in 3.3.1 (assuming any version tbh), the link to the attachment doesn't work, because wpthumb is trying to use the function imagesize on a permalink/single picture template, i.e. /attachment/1/ . I've seen other image handling solutions first check if the file/path is actually an image and only then run the function.

line 1480 of GdThumb.inc (so not even wpthumb).

resizing to absolute dimensions and copping howto?

I want to resize a photo so to take a maximum width and if the height is bigger than my maximum height do a cropping. I use WP 3.42.

I use the code

src="'.wpthumb($myimg,'width=780&height=358&resize=true&crop=1&crop_from_position=center,center&background-fill=solid'"/>';

The dimensions of produced photo are 780 x 550 and it does not seem to do the crop

Background-fill fail online, but work on localhost

Hi,
i use this code to place thumbnail of logo centered in a white square

160, 'height' => 160, 'background_fill' => '255255255') ) ?>

This work well on my wamp : the logo is centererd in my square without croping and with white space added to fill the square : perfect!

But online, i've only a resize of the image, but the image is not square with whit fill...

How to debug this ?

thanks

Database Efficiency

For each image that is run through wp_thumb, a bunch of rows with meta data is created. Since I always use default settings. Are these rows motivated?

If it's really needed, it should also be more efficient if you store the data in 1 row / image, using serialize(). I'd love to contribute, but are not really familiar working on other peoples code like this.

Using serialized data, could also reduce alot of "get_post_meta()" calls you have at the moment.

watermark not working?

I cannot seem to get watermarking to work using the manual PHP method. I have the URL to a local JPG image that is 1875 × 1275 and the URL to a local PNG image that is 249 × 71. I am creating an image that is 450px wide using wpthumb. I am developing locally. The image is resizing perfectly but I cannot get the watermark to show up at all. I have tried a lot of options and searched the internet for solutions but cannot figure this one out.

Here is the code:
$img_src = 'http://playbackmedia.loud/wp-content/shopp_media/livebyfaith-big.jpg'; $watermark_args = array( 'mask' => 'http://playbackmedia.loud/wp-content/themes/playbackmedia/img/pbm-watermark-crop.png', 'padding' => 0, 'position' => 'cc', 'pre_resize' => true ); $img_args = array( 'width' => 450, 'watermark_options' => $watermark_args ); echo '<img src="'.wpthumb( $img_src, $img_args ).'" alt="" class="">';

WPThumb Shortcode

I create a simple shortcode to insert external images.
Here is the code:

function image_shortcode($atts) {
extract(shortcode_atts( array(
"url" => '',
"width" => '',
"height" => '',
"crop" => ''
), $atts));
$img = wpthumb($url,'width='.$width.'&height='.$height.'&crop='.$crop.'');
return "<img src='$img'/>";
} add_shortcode( 'img', 'image_shortcode' );

Usage
[img url="http://...theimage.jpg" width="100" height="100" crop="1"]

Clear.gif bug

On rufflr - I accidentally added a product using a spacer gif rather than the actual product image. It caused the following error below.

When I vardumped $file_path at the top of the WPThumb __construct function it was referring to the clear.gif file.

Permissions were set correctly and when I removed this file - it all worked correctly.

Fatal error: Uncaught exception 'RuntimeException' with message 'File not writeable: /Users/matthew/Sites/Rufflr/wp-content/uploads/cache/2011/11/clear/1730765640.png.png' in /Users/matthew/Sites/Rufflr/wp-content/plugins/hm-core/WPThumb/phpthumb/src/GdThumb.inc.php:1072 Stack trace: 0 /Users/matthew/Sites/Rufflr/wp-content/plugins/hm-core/WPThumb/wpthumb.php(227): GdThumb->save('/Users/matthew/...', 'png') 1 /Users/matthew/Sites/Rufflr/wp-content/plugins/hm-core/WPThumb/wpthumb.php(29): WP_Thumb->generateCacheFile() 2 /Users/matthew/Sites/Rufflr/wp-content/plugins/hm-core/WPThumb/wpthumb.php(528): WP_Thumb->__construct('/Users/matthew/...', Array) 3 [internal function]: wpthumb_post_image(false, '559', Array) 4 /Users/matthew/Sites/Rufflr/wp-includes/plugin.php(170): call_user_func_array('wpthumb_post_im...', Array) 5 /Users/matthew/Sites/Rufflr/wp-includes/media.php(143): apply_filters('image_downsize', false, '559', Array) 6 /Users/matthew/Sites/Rufflr/wp-includes/media.php(604): image_downsize('559', Array) 7 in /Users/matthew/Sites/Rufflr/wp-content/plugins/hm-core/WPThumb/phpthumb/src/GdThumb.inc.php on line 1072

wp-thumb breaked under wp 3.5.1. ?

Hi,
i just put on your plugin on my local wp dev, has i do usually,
but when i activate it, i haven't any thumbnail in the WP administration.
If i unactive WPThumb, all my thumb came back.

DO you ahve any idea to solve this ?

Error notice in wpthumb_post_image()

wpthumb_post_image() has this check at the very start:

if ( ( ! strpos( (string) $args, '=' ) ) && ! ( is_array( $args ) && isset( $args[0] ) && $args[0] == $args[1] ) ) {

and if $args is array it errors, because PHP doesn't cast arrays to strings.

PS could also use comment about what it actually checks, it is a little... non-obvious :)

Support uploads_use_yearmonth_folders

If uploads_use_yearmonth_folders is set to false in WordPress then uploaded files are all stored in wp-content/uploads/, this is especially important when safe_mode is active as mkdir breaks writing files on some systems when safe_mode is active.

If uploads_use_yearmonth_folders is false we should store cache files in uploads as well

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.