// Finally, move the files to the various size directories and rename them back to the correct name
reset ($this->config['imageSizes']);
+
while (list($k, $v) = each($this->config['imageSizes'])) {
// Check if size directory needs to be made
// If there's an entry in the $sizes array, it means that the image resized to this size
if (isset($sizes[$k])) {
- // Move resized file to desired direectory
- rename(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$sizes[$k]['file'], GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$newFilename);
+ // Copy resized file to desired directory
+ copy(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$sizes[$k]['file'], GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$newFilename);
} else {
// Image didn't resize to this size, probably because it was smaller than the destination size (silly WP Image Editor class) - so just use the original
copy(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$newFilename, GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/'.$k.'/'.$newFilename);
}
}
+ // Since we copied the files from the main images directory we need
+ // some clean-up here.
+ foreach ( $sizes as $imgSize => $imgData ) {
+ @unlink( GLM_MEMBERS_PLUGIN_IMAGES_PATH . '/' . $imgData['file'] );
+ }
// Move the original to original directory
if (!file_exists(GLM_MEMBERS_PLUGIN_IMAGES_PATH.'/original')) {
* @var float
* @access public
*/
- public $fileProcessCountPerRound = 10;
+ public $fileProcessCountPerRound = 40;
/**
* photoProcessCountPerRound
*
* @var float
* @access public
*/
- public $photoProcessCountPerRound = 10;
+ public $photoProcessCountPerRound = 40;
/**
* numberProcessed
// We have to add one to $ending (array starts at 1 not 0).
$ending++;
for ( $index = $start; $index < $ending; $index++ ) {
- //foreach ( $photoData as $photo ) {
$photo = $photoData[$index];
+ $this->photosProcessed++;
// If there's no url or the url is not valid then skip it.
if ( $photoUrl = filter_var( $photo['image'], FILTER_VALIDATE_URL ) ) {
// Need to first get the member id from the database
if ( !$memberInfoId ) {
continue;
}
+ // There's a character limit on the photo caption field
+ // of 255 (mysql TINYTEXT)
+ $caption = substr( $photo['caption'], 0, 250 );
$res = $ImageUpload->storeImage(
$photoUrl,
$refType,
$refTable,
$memberInfoId,
- $photo['caption']
+ $caption
);
+ if ( !$res ) {
+ $this->errors = true;
+ }
}
- $this->photosProcessed++;
}
$ending++;
for ( $index = $start; $index < $ending; $index++ ) {
$file = $filesData[$index];
+ $this->filesProcessed++;
// If there's no url or the url is not valid then skip it.
if ( $fileUrl = filter_var( $file['file_url'], FILTER_VALIDATE_URL ) ) {
// Need to first get the member id from the database
$file['file_name']
);
}
- $this->filesProcessed++;
}