Tips and Tricks HQ Support Portal › Forums › WP Photo Seller › Photo Seller – watermark in bulk import failed
- This topic has 9 replies, 3 voices, and was last updated 7 years, 4 months ago by Peter.
-
AuthorPosts
-
June 7, 2017 at 5:20 pm #14297DesMasMember
Hi
I’m uploading images via zip bulk-import into a gallery with activated watermark.
The watermark process stopped at the last picture.
Code:watermarking – gallery 7 Processing image 137 of 137 in_progressThe debug log shows the following line:
Code:[LOG DATE: 06/07/2017 6:42:51 pm – Server time zone UTC]
[WPSPhotoProduct.php – line 133] image_make_intermediate_size() failed for file: /kunden/179445_24211/SSG4/wp-content/uploads/wp_photo_seller//The picture itself is intact, as I can view it in the front-end.
Any idea what the reason is?
I also tried to deactivate the watermark setting, saved the gallery and then reactivated the setting, but that did not help.
Plugin-Version: 2.1.5
Wordpress Version: 4.7.5
WPMU: No
MySQL Version: 5.6.19
PHP Version: 5.6.21
Session-Speicherort: /tmp
CURL Bibliothek-Schenkung: Yes
Datei Schreibrechte debuggen: Writable
June 7, 2017 at 6:19 pm #75815DesMasMemberHi
The bulk-import seems also to break at some circumstances when no watermark is enabled.
I tried to bulk-import 5 zip files, all with 50 images in them.
The last file got stuck at Processing image 243 of 246.
That showed me that allready 4 images did not get correctly imported. Therefore I took a look into the upload folder (wp-content/uploads/wp_photo_seller/7/a45798fz40) for this gallery and there are 4 zero-byte files listed with numeric names: , 19, 4, 7, 9.
246+4 = 250 files.
so, whats wrong here?
June 8, 2017 at 1:54 am #75816PeterMemberWhat type of hosting is your site on – shared, VPS, other?
What is the value of your server’s PHP memory_limit?
Can you please check your server’s PHP error log file? Look for any logs which are related to the photo seller and also logs which pertain to the server’s memory.
What is probably happening in your case is that sometime during the bulk import/watermarking process your server is running out of memory and hence the watermarking is failing at that point.
If most of the other photos in the zip file were successfully imported, you can simply go to the gallery settings page and manually upload the handful of photos which failed.
ps: I also recommend that you also grab the latest version of the plugin:
https://support.tipsandtricks-hq.com/forums/topic/re-install-or-load-a-fresh-build-of-the-plugins
June 10, 2017 at 9:13 am #75817DesMasMemberHi
the reason for the zero-byte files has been identified and remove. there was an error in my zip-process.
The watermarking process still fails around image no. 140 (138-141). As there was nothing usefull to find in WP debug_log.txt and WPS log.txt, I now upgrade the server to am more powerfull system.
old system had:
– 30 CPU sec.
– 180 script sec.
– 256 MB PHP Memory Limit
new one will have:
– 60 CPU sec.
– 300 script sec.
– 512 MB PHP Memory Limit
add:
the shop was also upgraded to version 2.2.0.
June 10, 2017 at 1:50 pm #75818DesMasMemberHi Peter
short update:
Due the server upgrade I can now handle bulk-uploads of up to 200 files at once and a watermarking process of up to 500 pictures per gallery.
I posted a little suggest, for a better handling with share-hosters: https://support.tipsandtricks-hq.com/forums/topic/feature-request-optimized-watermark-process?replies=1#post-86788
July 20, 2017 at 8:58 am #75819DesMasMemberHello Peter,
it seams some watermarking processes are still failing due script runtime issues.
Is there a possibility to call the watermark process for a gallery directly from the console so it might run faster?
July 21, 2017 at 9:46 am #75820DesMasMemberHello Peter.
The problems i have with the watermark process let me take a look into the code.
Inside the function WPSGallery::createGalleryWatermarkedImages(), that manages this job, i noticed that you are working with a fixed value of 30 seconds: set_time_limit(30).
That forces the script to break after this amount of time, even if the php.ini defines a higher value.
Therefore i did a little hack of the code:
In front of the main foreach loop i added a request to determine the server value:
Code:$max_execution = ini_get(‘max_execution_time’);
if($max_execution !== false && $max_execution !== “”){
$max_execution = intval($max_execution);
}your checks for the progress time i changed to the following:
Code:if($progress – $start > $max_execution){
set_time_limit($max_execution); //reset time limit so there is no timeout
}This seems to work, so the script now honors the server setting.
Then i wanted to introduce a “skipped count” for the watermark log as i noticed that your called functions return with value 2 if the watermark already exists. A “noop else branch” was already existing in your code:
Code:if(!$result){
++$fail_count;
WPSCommon::log(‘[‘ . basename(__FILE__) . ‘ – line ‘ . __LINE__ . “] Creation of watermark failed for gallery ID “.$gallery_id.”, filename: “.$file_name);
}elseif($result == 2){
//do nothing watermark already exists
}else{
++$success_count;
}But your if/else construct does not seem to work correctly, due my introduced skip_count variable was always incremented:
Wasserzeichen Prozess erfolgreich beendet. Anzahl Bilder: 200 von 200 skipped: 200
Der Massenimport wurde erfolgreich abgeschlossen. Anzahl importierter Bilder: 100 von 100
So i changed the construct to type safe comparisons:
Code:if($result === false){
++$fail_count;
WPSCommon::log(‘[‘ . basename(__FILE__) . ‘ – line ‘ . __LINE__ . “] Creation of watermark failed for gallery ID “.$gallery_id.”, filename: “.$file_name);
}elseif($result === 2){
//do nothing watermark already exists
++$skip_count;
}else{
++$success_count;
}and the values in the “Update the events table” now gets protocoled correctly:
Code:if($event_id != 0){
if($abort){
$event_status = ‘aborted’;
$event_data = __(‘Watermarking was aborted. Number of images watermarked: ‘,’WPS’).$i.’ ‘.__(‘of’,’WPS’).’ ‘.$num_images.’ skipped: ‘.$skip_count;
}else if($fail_count > 0){
$event_status = ‘completed’;
$event_data = __(‘Watermarking has completed with failures. Number of failed watermarks: ‘,’WPS’).$fail_count.’ ‘.__(‘of’,’WPS’).’ ‘.$num_images.’ skipped: ‘.$skip_count;
}else{
$event_status = ‘completed’;
$event_data = __(‘Watermarking has completed successfully. Number of images watermarked: ‘,’WPS’).($i-1).’ ‘.__(‘of’,’WPS’).’ ‘.$num_images.’ skipped: ‘.$skip_count;
}new log:
Wasserzeichen Prozess erfolgreich beendet. Anzahl Bilder: 461 von 461 skipped: 400
Der Massenimport wurde erfolgreich abgeschlossen. Anzahl importierter Bilder: 61 von 61
Wasserzeichen Prozess erfolgreich beendet. Anzahl Bilder: 400 von 400 skipped: 300
Der Massenimport wurde erfolgreich abgeschlossen. Anzahl importierter Bilder: 100 von 100
Maybe this is an useful approach.
July 21, 2017 at 2:10 pm #75821PeterMemberHi DesMas,
Thanks for that.
I will email you and you can send me your changes and I will independently try them and if all is good I will check them into the official version.
July 25, 2017 at 3:03 am #75822bvnesbitMemberi just have to say thank you DesMas! That code really helps! I have been plagued by time out issues and this made it work much better. Peter, please add this to the main code for every else, I know you gotta check it out still, but it solved a big headache for me.
July 25, 2017 at 6:20 am #75823PeterMemberYes thanks to DesMas for his code and thanks to bvnesbit for your feedback too.
I will include it in the main code.
-
AuthorPosts
- You must be logged in to reply to this topic.