Testing this module out on a vanilla core install I get the following error:
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'field_image_width' at row 1: INSERT INTO {field_data_field_image} (entity_type, entity_id, revision_id, bundle, delta, language, field_image_fid, field_image_alt, field_image_title, field_image_width, field_image_height) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => article [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => 1 [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => [:db_insert_placeholder_9] => [:db_insert_placeholder_10] => ) in field_sql_storage_field_storage_write() (line 448 of /modules/field/modules/field_sql_storage/field_sql_storage.module).
To replicate the issue:
1. Install Drupal 7.14 (Standard, not minimal)
2. Install and enable ImageAPI Optimize (It looks like Beta2 is a later version than the dev, so I tested it against the Beta 2 version)
3. Select an image processing toolkit: ImageAPI Optimize
4. ImageAPI Optimize Service: Yahoo! Smush.It
5. Add an Article Content Type with an image
6. Upon saving, you will see the above error, followed by "The website encountered an unexpected error. Please try again later. "
In dblog I also see the following few more notices/errors:
Unable to generate the derived image located at public://styles/thumbnail/public/field/image/42-15763278_0.jpg.
The selected image handling toolkit imageapi_optimize can not correctly process image_imageapi_optimize_get_info.
Refresh ImageAPI methods
I can confirm that GD2 image manipulation toolkit was working correctly before switching to imageapi_optimize
I can replicate the issue in several environments
Any thoughts?
Comments
Comment #1
jcisio CreditAttribution: jcisio commented- Do you have curl PHP extension enabled? It is required for external service like Smush.it.
- Another reason is smush.it could have changed, or its service is (temporarily) not available. Currently I try to upload several images at http://www.smushit.com/ysmush.it/ and always get error (look at http://dev.jcisio.com/snap/20120606230646.png).
- Finally, I suggest that you try with other option (internal tools available in your server).
I think I'll switch this issue for better error handling.
Comment #2
jcisio CreditAttribution: jcisio commentedI'm even not sure if this is a Field SQL Storage bug.
Comment #3
pixelsweatshop CreditAttribution: pixelsweatshop commentedcURL wasn't enabled. However, it is now in there and still shows the same issue.
I have disabled Smushit and returned to using an internal tool: jpegtran (confirmed that it is indeed in usr/bin/jpegtran) and I still receive the same error.
Did some digging to see if there were some related issues that might be of help:
#1226698: PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value
#1600306: General error: 1366 Incorrect integer value: '' when trying to set checkbox data value from node to commerce_product
Comment #4
jcisio CreditAttribution: jcisio commentedThe error is there just because image could not be created, so it weight is '' instead of '0' or any integer and a PDFException is thrown out.
Ok I dig a bit more in the code. Could you tell me which value you have with
_imageapi_optimize_get_methods()
andcache_get('imageapi_optimize:methods')
?Comment #5
pixelsweatshop CreditAttribution: pixelsweatshop commentedI can't seem to find these values. Where should I be looking?
Comment #6
jcisio CreditAttribution: jcisio commented_imageapi_optimize_get_methods() is a function in ImageAPI Optimize module that returns a list of implemented image toolkit action.
Comment #7
pixelsweatshop CreditAttribution: pixelsweatshop commentedSorry. I am going to need a little hand holding here on the steps I need to do to get you the info you require. :)
Comment #8
protools CreditAttribution: protools commentedsame error with curl PHP extension enabled. Drupal 7.14
PHP Version 5.3.15
MySQL version 5.5.25
with smash.it and with local jpegtran
function _imageapi_optimize_get_methods() {
$funcs = get_defined_functions();
$methods = array();
$prefix = 'image_' . variable_get('imageapi_optimize_toolkit', '') .'_';
foreach ($funcs['user'] as $func) {
if (strpos($func, $prefix) === 0) {
$method = substr($func, strlen($prefix));
if (!in_array($method, array('load', 'save', 'settings'))) {
$methods[] = $method;
}
}
}
cache_set('imageapi_optimize:methods', $methods);
watchdog('imageapi', 'Refresh ImageAPI methods');
return $methods;
}
Comment #9
jcisio CreditAttribution: jcisio commentedIf you want to help, reproduce and debug with the following steps:
- Use a clean install, with this module only
- Chose SmushIt service only
- Debug where we can prevent the error (I think we may need an IF somewhere).
Or simply wait until I have more time.
Comment #10
protools CreditAttribution: protools commentedI try again:
MAMP 2.1.1 Server
cURL support enabled
Drupal 7.15 standart clean install, with this module only. Only Smushit service chosen:
when i choose file, in drupal log :
The selected image handling toolkit imageapi_optimize can not correctly process image_imageapi_optimize_get_info.
Unable to generate the derived image located at public://styles/thumbnail/public/field/image/IMG_1362.jpg.
when save node:
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'field_image_width' at row 1: INSERT INTO {field_data_field_image} (entity_type, entity_id, revision_id, bundle, delta, language, field_image_fid, field_image_alt, field_image_title, field_image_width, field_image_height) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => article [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => 2 [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => [:db_insert_placeholder_9] => [:db_insert_placeholder_10] => ) in field_sql_storage_field_storage_write() (line 448 of /Volumes/Work/Projekt/MY/imgoptim/drupal/modules/field/modules/field_sql_storage/field_sql_storage.module).
Comment #11
protools CreditAttribution: protools commentedmaybe this help to fix it :
http://drupal.org/node/1330952
i try patch from #9 in that issue, error message has gonne,
original image are uploaded, but no one image style generated. I test with Smushit and with local jpegtran.
Comment #12
jcisio CreditAttribution: jcisio commentedOk, it happens with core modules, it can be reproduced with just core modules. It should be fixed in core. I'm even not sure if ImageAPI Optimize could do anything.
Patch #9 from that issue helps, but it is not the right direction.
I'm closing this issue in favor of #1330952: Saving an Image field with an image that has undeterminable dimensions throws PDOException.. If you have problem with SmushIt, and if this service works well (not what I described in #1), please submit a new issue, may be SmushIt "API" has changed and we need to update our code.
Comment #13
protools CreditAttribution: protools commentedOnly this part off error gonne away :
PDOException: SQLSTATE[HY000]: .....
but this
The selected image handling toolkit imageapi_optimize can not correctly process image_imageapi_optimize_get_info.
Unable to generate the derived image located at public://styles/thumbnail/public/field/image/IMG_1362.jpg.
still there ! with Smushit and with local jpegtran
Comment #14
head CreditAttribution: head commentedjcisio
Project is dead?
Comment #15
jcisio CreditAttribution: jcisio commentedNope.
Comment #16
jcisio CreditAttribution: jcisio commentedFor one who looks at this issue: I've just looked at the issue in #12 (#1330952: Saving an Image field with an image that has undeterminable dimensions throws PDOException.) again, and there is a new patch. Patch #42 is visibly better and I think it solves problems like one that protools pointed out in #13.
Comment #17
head CreditAttribution: head commentedYou know about punypng?
The service is paid.
Is it possible to add it to your project?
Comment #18
jcisio CreditAttribution: jcisio commentedPlease don't change the status without a reason. And please don't do issue hijacking. Open a new issue for new request.
Comment #19
head CreditAttribution: head commentedThe module does not work with the latest drupal7.
Smush.It, jpegtran produce an error, as pointed out above.
Why you do not mention it on the description page of the module?
Much time is spent figuring out the cause.
Comment #20
jcisio CreditAttribution: jcisio commented@head it does not work for you, but it works with a thousand other sites. I don't know what to add on the project page. If you have suggestion, you're welcome.
Comment #21
pixelsweatshop CreditAttribution: pixelsweatshop commentedI am the OP of this issue. I managed to get this working eventually after revisiting it a few months later. I should have posted back with what I had to do to get it working. IIRC it was something super simple, a cache flush after installation. It then worked fine with smushit. I am using it on several production sites now without issue.
Comment #22
head CreditAttribution: head commentedalways use
drush cc all and drush image-flush --all
ysmush.it works, but not always.
jpegtran refuses to continue, but the generation of the image can be seen under certain conditions.
I will post details later.
Thanks for the reply.
Comment #23
theMusician CreditAttribution: theMusician commented#21 and #22 work like a champ. A full cache flush fixes the issue.