Coder Social home page Coder Social logo

wp-image-processing-queue's People

Contributors

a5hleyrich avatar bradt avatar grappler avatar rorymcdaniel 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

wp-image-processing-queue's Issues

Support for focal point (crop/background position)

First off, thanks for this library, it seems extremely useful!

When generating images to be used as a background image (Cover Block, etc) there are 2 requirements in order to use this library:

  1. Allow different aspect ratios at different window sizes (pretty sure this already works).

  2. Allow a focal point so different sizes are cropped in the correct location.

Since the block editor now has and uses this
https://developer.wordpress.org/block-editor/components/focal-point-picker/ It would be super useful to be able to pass the focal point (in relation to the original image) and have the additional image sizes use this focal point when generating new images.

Maybe there is a better solution, but either way it would be great to insure the focal point is always centered on all the images.

Conflict with wp_queue() of mailchimp for woocommerce plugin

Hello, after installing the plugin this message has shown:

Fatal error: Uncaught ArgumentCountError: Too few arguments to function wp_queue(), 0 passed in wp-content\plugins\image-processing-queue\image-processing-queue.php on line 36 and at least 1 expected in wp-content\plugins\mailchimp-for-woocommerce\bootstrap.php:156 

Stack trace: #0 wp-content\plugins\image-processing-queue\image-processing-queue.php(36): wp_queue() 

#1 web\wp-admin\includes\plugin.php(2141): 

 #2 web\wp-admin\plugins.php(175): plugin_sandbox_scrape('image-processin...') #3 {main} thrown in \wp-content\plugins\mailchimp-for-woocommerce\bootstrap.php on line 156

The same function wp_query() is initialized by https://wordpress.org/plugins/mailchimp-for-woocommerce/ so it makes name conflict.

Detect if job already exists

It's possible to push multiple background jobs to the queue for the same image. We need to check if the image already has a background job outstanding before pushing another to the queue.

WP_Background_Process

image-processing-queue.php makes reference to a vendor folder, which doesn't seem to exist in this repo.

Do we need to include another library in order for this one to work? I've noticed the WP.org repo has the vendor folder.

Thanks!

Support when local file removed from server

Currently, this doesn't work when the local file has been removed from the local server. Needs further investigation, but I'm not sure if GD or Imagick support stream wrappers. We may have to download the file locally resize it, then upload to S3 as a workaround.

Thumbnails created, but only accessible via wp_get_attachment_image_srcset

Hi,

I am using WP 4.8.1 and image-processing-queue v0.2 via plugins.

When I request an image with ipq_get_theme_image like the blog post suggests:

$post_id_test = 166;

echo ipq_get_theme_image( $post_id_test, array(
		array( 600, 600, false ),
		array( 1280, 1280, false ),
		array( 1600, 1600, false ),
	),
	array(
		'class' => 'header-banner'
	)
);

The 600, 1280 and 1600 images are created locally after you first visit the page, but then if I refresh the srcset only includes the standard WP sizes, not the new thumbs. I can only access them by executing echo wp_get_attachment_image_srcset( $post_id_test ); but clearly that's not the best solution.

It looks like it "almost" works, ipq_get_theme_image returns this HTML:

<img width="600" height="600" src="http://myurl.com/content/uploads/2017/08/20151113_082424-2106x2106.jpg" class="header-banner" alt="" srcset="http://myurl.com/content/uploads/2017/08/20151113_082424-2106x2106.jpg 2106w, http://myurl.com/content/uploads/2017/08/20151113_082424-150x150.jpg 150w" sizes="(max-width: 600px) 100vw, 600px">

So it knows it should use the 600px image, as its specified in the width, height and sizes attributes, however calling echo wp_get_attachment_image_srcset( $post_id_test ); returns this:

http://myurl.com/content/uploads/2017/08/20151113_082424-300x169.jpg 300w, http://myurl.com/content/uploads/2017/08/20151113_082424-768x432.jpg 768w, http://myurl.com/content/uploads/2017/08/20151113_082424-1024x576.jpg 1024w, http://myurl.com/content/uploads/2017/08/20151113_082424-600x338.jpg 600w, http://myurl.com/content/uploads/2017/08/20151113_082424-1280x720.jpg 1280w, http://myurl.com/content/uploads/2017/08/20151113_082424-1600x900.jpg 1600w

Could it be because I have already added some images via add_image_size? I have added a 2106 x 2106 square image, which is being picked up in ipq_get_theme_image but not with wp_get_attachment_image_srcset :-\

I haven't reproduced this on a completely clean WP install yet, but I've tried it both locally on Windows 10 and then on our host just to be sure - same issue.

($post_id_test is a brand new image I uploaded to the media library to for testing and I am running the function on page.php)

ipq_get_theme_image_url: × (multiplicator sign) instead of letter x in URL

Hey,

I'm using Wordpress 5.3.2 and the plugin version 1.1.1.
I can't get ipq_get_theme_image_url to work.
The pictures in the upload folder have the normal "x" between width and height, "x" -> test-320x420.jpg
But the output URL has the multiplicator sign (U+00D7), × -> test-320×420.jpg
So the URL of the image doesn't work, because the picture doesn't exists (with muliplicator sign).

This is my test code:

                $imageID = get_sub_field( 'hintergrundbild' );
                echo ipq_get_theme_image_url( $imageID, array( 320, 420, true ) );
                echo ipq_get_theme_image ( $imageID, array(
                        array( 320, 420, true ),
                    ),
                    array(
                        'class' => '',
                    )
                );

ipq_get_theme_image works fine.

Does anybody know a solution?

Best regards,
Alex

working locally?

Hello,

Installed your (probably) awesome and (certainly) needed work locally, but it seems not to work here... No error, the tag is displayed on the template, but the image is not resized and the src link is still the full image (also, the image sizes meta have not been updated).
<img width="317" height="400" src="https://test.dev/wp-content/uploads/2015/05/17353604_1490626997627722_8477959042079393974_n.jpg" class="header-banner" alt="">
Checked the permissions on wp-content/uploads, which are ok, and the add_image_size is working. I think for some reason, task() in IPQ_Process() is not triggered, but I don't know why...

Multiple Queue Runs Required to generate all image sizes for the same attachment

For example, if I have:

ipq_get_theme_image_url(SOME_IMAGE_ATTCH_ID, [ 1280, 630, true ] )

followed by:

ipq_get_theme_image_url(SOME_IMAGE_ATTCH_ID, [ 2560, 1260, true ] )

The first call will be successfully added as a job; however the second one will not process until the first one is cleared (thereby unlocking the attachment's post)

Suggestion

Ideally there would only be one lock per size, per attachment not just per attachment

Add template function for retrieving url of the desired image size

Hello,

first of all, this looks awesome. My question is, have you thought about providing a template function that would return only the url of the specified image size? It could for example return the full-size image url if the desired size is not yet available, or if the image is not big enough to satisfy the size request.

Thanks

Errors logged when resized image bigger than original

This seems to cause an infinite loop of background jobs. We need to check if the requested size is bigger than the original and just return the full size URL.

PHP Fatal error: Call to undefined method WP_Image_Editor_Imagick::get_error_message() in /Users/ashley/Repos/wp-image-processing-queue/includes/class-ipq-process.php on line 75

PHP Fatal error: Class 'Image_Processing_Queue\Exception' not found in

Hello,

I have this issue in the debug.log
Thanks in advance.

[13-Apr-2018 12:48:45 UTC] PHP Fatal error:  Class 'Image_Processing_Queue\Exception' not found in .../content/plugins/image-processing-queue/src/Image_Processing_Queue/Exception.php on line 8
[13-Apr-2018 12:48:45 UTC] PHP Stack trace:
[13-Apr-2018 12:48:45 UTC] PHP   1. {main}() .../wp/wp-cron.php:0
[13-Apr-2018 12:48:45 UTC] PHP   2. do_action_ref_array() .../wp/wp-cron.php:117
[13-Apr-2018 12:48:45 UTC] PHP   3. WP_Hook->do_action() .../wp/wp-includes/plugin.php:515
[13-Apr-2018 12:48:45 UTC] PHP   4. WP_Hook->apply_filters() .../wp/wp-includes/class-wp-hook.php:323
[13-Apr-2018 12:48:45 UTC] PHP   5. WP_Queue\Cron->cron_worker() .../wp/wp-includes/class-wp-hook.php:298
[13-Apr-2018 12:48:45 UTC] PHP   6. WP_Queue\Worker->process() .../content/plugins/image-processing-queue/vendor/a5hleyrich/wp-queue/src/WP_Queue/Cron.php:105
[13-Apr-2018 12:48:45 UTC] PHP   7. Image_Processing_Queue\Resize_Job->handle() .../content/plugins/image-processing-queue/vendor/a5hleyrich/wp-queue/src/WP_Queue/Worker.php:46
[13-Apr-2018 12:48:45 UTC] PHP   8. spl_autoload_call() .../content/plugins/image-processing-queue/src/Image_Processing_Queue/Resize_Job.php:73
[13-Apr-2018 12:48:45 UTC] PHP   9. Composer\Autoload\ClassLoader->loadClass() .../content/plugins/image-processing-queue/src/Image_Processing_Queue/Resize_Job.php:73
[13-Apr-2018 12:48:45 UTC] PHP  10. Composer\Autoload\includeFile() .../content/plugins/sitepress-multilingual-cms/vendor/composer/ClassLoader.php:322
[13-Apr-2018 12:48:45 UTC] PHP  11. include() .../content/plugins/sitepress-multilingual-cms/vendor/composer/ClassLoader.php:444

Unable to crop?

Hi, so I am running the code for these banner images found on this site here, and when I call to it within my code, I assumed it was under the normal array of add image size.

add_image_size( w, h, crop? )

With my code, I am doing so within the first array, or in this sense 0, 590, array('center','center') however, upon doing so crops the image down from 2000x890 to 1326x590 and ignores the third parameter, the cropping. I needed the image to stay at 2000px wide and crop the height to 590px with the focus on the center.

Am I doing something wrong? Do I have my code set up wrong? What's going on?

ipq_get_theme_image( $image_ID,
    array(
        array( 2000, 590, array( 'center', 'center' )  ),
        array( 1000, 445, array( 'center', 'center' ) ),
    ),
    array(
      'class' => 'img-responsive',
      'alt'   =>  __( $title, 'boss' ),
    )
);

Call to undefined method WP_Image_Editor_Imagick::get_error_message()

Running includes/class-ipq-process.php:75 triggers PHP Fatal error: Uncaught Error: Call to undefined method WP_Image_Editor_Imagick::get_error_message()

I think you mean to get the message from a WP_Error object, but you're not saving one during the resize. Something like this should work:

$result = $editor->resize( $width, $height, $crop );
if ( is_wp_error( $result ) ) {
	throw new IPQ_Process_Exception( 'Error resizing image: ' . $result->get_error_message() );
}

Problem when web site is protected by a htaccess/htpasswd

Hi,

I am using WordPress 4.8, Image Processing Queue v0.2 via plugins and Offload S3 Lite to store medias on an Amazon bucket. In the development process of a web site, we often need to make a version available of the web site to our client so he can enter or modify his content in the admin panel. The version we make available to the client is protected with a htaccess/htpasswd to prevent Google to crawl the web site until the official release. This protection make the image processing impossible. Do you have any idea on how we can make it work also in this context?

Thank you.

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.