humanmade / wpthumb Goto Github PK
View Code? Open in Web Editor NEW:warning: UNMAINTAINED :warning: On demand image resizing for WordPress
Home Page: https://humanmade.co.uk/wpthumb/
:warning: UNMAINTAINED :warning: On demand image resizing for WordPress
Home Page: https://humanmade.co.uk/wpthumb/
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
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 :)
Hi
can I use this to generate black and white thumbnails?
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.
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 ?
"Nice to have" feature which would bring value to significantly larger sites (i.e. media sites that need to retain attribution/copyright, quite possible that this is easily overlooked).
Discussion on Stack: http://stackoverflow.com/questions/10182890/copy-an-image-preserve-its-exif-iptc-data-with-php-imagecreatefromjpeg
(would only apply to jpg & tiff)
wp_thumb() should be changed to wpthumb() on your website:
http://hmn.md/introducing-wp-thumb/
I media settings.
Hi i try to archive this effect usign the phpThumb lib
http://phpthumb.sourceforge.net/demo/demo/phpThumb.demo.demo.php#x29
How to do this ?
i use this code
202, 'height' => 120, 'crop'=>'true')); ?>thanks
as per title
Hello
Is there a way to mask an image with a shaped image in WPThumb? If not then how can I apply this GD function on uploaded image:http://stackoverflow.com/questions/7203160/php-gd-use-one-image-to-mask-another-image-including-transparency
I'm kind of new to wp hooks so..
Thanks
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.*
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
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"]
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="">';
So that only originals are stored in wp-content/uploads.
Misunderstood your question earlier, all the phpthumb_
* functions should be renamed to wpthumb_
. Basically anything in wpthumb.php
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,
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?
80% is looking quite weak at smaller sizes (i.e. 1000px to 50px), pixely & loss of vibrancy. Food for thought.
Will fix issues with deleting the cache folder breaking old images inserted into post content.
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
which outputs full <img />
tag.
You get this warning if upload directory isn't set
Notice: Undefined index: path in /Users/willmot/Dropbox/Sites/liveview/wp-content/plugins/hm-core/WPThumb/wpthumb.php on line 946
Upload gif.
Get warnings.
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' );
}
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
Hi
I'm using wpthumb on my website to force cropping origin top left. But when the page loads, you can see the thumbnails being redrawn.
http://wpconsult.net/work
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.
Currently it shows for all files.
because WP Thumb just returns the original.
Basically same as add_image_size
except for support all wpthumb args.
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...
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).
Hi guys!
What is wrong in this code:
$default, 'width' => 870, 'height' => 370, 'crop' => 1 ) ); ?>
The default image is not working...
Thanks!
To reduce image sizes even further
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
Get this in error_log a lot.
Getting this on 3.3-beta1-18972.
Fatal error: Call to undefined function add_filter() in C:\ .... \WPThumb\wpthumb.php on line 387
Hi,
i use this code to place thumbnail of logo centered in a white square
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
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.