As soon as possible

rivez le logemerivez le logeme

Rent : 800 € incl. charges

Total area 190m²

Presentation

/**
 * Route uploading the photos of group in the page of groupWizard with the alias name 'photo'
 * @name 07-/groupPhotos/:groupUserId
 * @route {POST} /groupPhotos/:groupUserId
 * @memberof module:routes/uploadRoutes~uploadRouter
 * @routeparam {String} :groupUserId is the id of the user who creates the group
 */
router
	.route('/groupPhotos/:groupUserId')
	.post(upload.single('photo'), async (req, res) => {
		tools.log('Update fields', {
			id: `Photo - ${req.file.filename}`,
			preset: 'wizard',
		});

		const app_url =
			(process.env.LOCAL === 'true' ? 'https://' : 'http://') +
			req.headers.referer.split('/')[2];

		// Check if image compression is enabled
		if (process.env.COMPRESS_IMAGE === 'true') {
			const imageBuffer = fs.readFileSync(req.file.path); // Read the image as a buffer
			const image = sharp(imageBuffer);

			// Get metadata to check image dimensions
			const metadata = await image.metadata();

			// Define a threshold for resizing (e.g., 1000 pixels)
			const threshold = 1000;

			// Prepare the output file path for the WebP format
			const outputFilePath = path.format({
				dir: path.dirname(req.file.path),
				name: path.basename(req.file.path, path.extname(req.file.path)),
				ext: '.webp',
			});

			// Check if the image is larger than the threshold
			if (metadata.width > threshold || metadata.height > threshold) {
				// Resize the image if it's larger than the threshold
				await image
					.toFormat('webp', { quality: 90 }) // Convert to WebP and set quality
					.resize(threshold, threshold, { fit: 'inside' }) // Resize to fit within the threshold
					.toFile(outputFilePath, (err, info) => {
						if (err) {
							console.error('Error resizing image: ', err);
						}
					});
			} else {
				// If the image is smaller than the threshold, only convert to WebP without resizing
				await image
					.toFormat('webp', { quality: 90 }) // Convert to WebP and set quality
					.toFile(outputFilePath, (err, info) => {
						if (err) {
							console.error('Error converting image to WebP: ', err);
						}
					});
			}

			// Update the wizard's photo field with the new WebP file path
			updateWizard.updateFieldValue(
				req.params.groupUserId,
				{
					photos: path.basename(outputFilePath),
					$validation: 'image',
					$action: 'add',
				},
				res
			);
		} else {
			// If compression is disabled, use the original file
			updateWizard.updateFieldValue(
				req.params.groupUserId,
				{
					photos: req.file.filename,
					$validation: 'image',
					$action: 'add',
				},
				res
			);
		}
	});

How to book on Appartoo ?

Fill in some details and submit your booking request. No payment will be made until the owner confirms.

The owner reviews your request and responds within 24 hours. If accepted, you can finalize your booking and arrange your move-in.

Once the booking is confirmed, prepare for your move and collect the keys from the owner. You have 24 hours after arrival to report any issues.

Chambers

Room available
Room available
Room available
Room available

Position

static google map
photo of Anwar
Anwar
14 jours ago
See the phone number
14 views
800 €
loader