Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activation issue / HTTP error on media upload / feature suggestion #7

Open
HeatherActon opened this issue Dec 19, 2018 · 4 comments
Open

Comments

@HeatherActon
Copy link

Hi Amir!
We're giving your plugin a shot on a client site, where they want to be able to add searchable (front and back end) labels to each image (there are 1000s) in an automated fashion. We installed your plugin and noted a few issues. We'd love to work with you to improve this if you're available and willing!

Issues:

  • Upon activation there is an error due to a missing /vendor directory (so couldn't load /vendor/autoload.php). I "fixed" this in our version by commenting out line 17 of perception.php. I don't know if that really fixed anything, but given that directory didn't exist in the plugin download it at least allowed the plugin to activate.

  • After that, the plugin could activate and the setup steps were simple to follow. Except, we had to add a line to wp-config.php temporarily so that we could upload a json file through the WP media uploader. This explanation could be added to the readme, or, if a straight URL is accepted you could just direct the developer to upload the json file to root and provide the URL.

  • Once we went through setup, which apparently is ok, I thought that maybe existing images would be labeled. But I then realized they have to go through the upload process to be labeled with the meta tag. It may be a nice feature addition to allow a "regenerate Google labels" or something like that, so that if a user puts this on AFTER their media library is full, the labels will get generated for older images.

  • I did try uploading some images but got a generic HTTP error message in the media uploader. Disabling the plugin lets me upload images again, but uploading them with perception activated does not work currently. I didn't look too far into this.

Hopefully that helps! We'd love to be a part of making this plugin a great tool for our client and others, so let us know how we can help. Thanks!
Heather

@HeatherActon
Copy link
Author

Also, just confirming that composer is installed to the plugin (perception-master) directory, and the activation error still happens. Thanks!

@HeatherActon
Copy link
Author

Got it! I ran php composer.phar install in the directory as well, and that allowed the plugin to activate. This also allows the media uploader to work. And, the images were tagged with some great meta!

It may be worth updating the readme with that composer info for other noobs like me who don't know composer :-)

I think the only thing that we'd love for it to do is generate labels for images already in the media library, and this will be an awesome solution. There's a note in your inbox about this. Thanks much!!!

@HeatherActon
Copy link
Author

Hi again :-)
I wrote up some things for the readme if you'd like to add. Hopefully this helps!
-Heather

INSTALL THE PLUGIN, BUT DO NOT ACTIVATE YET
Use the normal WordPress installer or upload the unzipped version to your plugins directory.

INSTALL COMPOSER TO THE PLUGIN /perception-master/ directory
Run the following in terminal, ensuring you are in the /perception-master/ directory in your WordPress site.

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

INSTALL DEPENDENCIES
After composer is installed to /perception-master/, install dependencies by running the following in terminal.
php composer.phar install

ACTIVATE PLUGIN
After composer and dependencies are installed, you can now activate the plugin. Newly uploaded images will have meta values with the key _wp_attached_google_vision automatically generated.

Then go into all of the admin screen stuff with Google cloud setup and JSON file upload that you already have…

Note about uploading JSON file - will have to add exception to wp-config.php to use WP uploader:
define( 'ALLOW_UNFILTERED_UPLOADS', true );
(Remove the above from wp-config.php when done, for security.)

OR …is it possible to just upload the JSON file to your site via FTP and just paste in a URL?

@amirandalibi
Copy link
Owner

Hi @HeatherActon,

Thanks for trying the plugin out!

  • I'm glad that you did figure out the composer installation.
  • There's a filter inside the plugin that allows json upload by adding json extension into Wordpress mime list, but I'll look into what you mentioned since it's causing an issue. Also can you confirm if you had admin role when uploading json?
  • Regenerating labels for older images is something I intended to add in the next version.
  • That's also because vendor folder was missing.

I'll add something into readme file for people not familiar with composer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants