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

Duplicate images with same filename #84

Closed
nlemoine opened this issue Jul 12, 2019 · 2 comments

Comments

@nlemoine
Copy link
Contributor

commented Jul 12, 2019

Hi,

I'm facing a strange issue when some file have the same filename (but are in different folders).

Here's the test case: https://www.dropbox.com/s/00nycs96n8vyfuy/duplicate-images.zip?dl=1

Just extract the archive, cd into the directory and run php index.php.

One of the images with the same filename is duplicated. I tried to dig a little bit, looks like something goes wrong with in the tmp folder. I didn't have time to go further for now.

Could you have a look? You'll probably spot the issue faster than I do.

@freekmurze

This comment has been minimized.

Copy link
Member

commented Jul 16, 2019

I'm sorry I don't have time to look into your specific project. Feel free to PR a failing test for me to solve.

@freekmurze freekmurze closed this Jul 16, 2019

@nlemoine

This comment has been minimized.

Copy link
Contributor Author

commented Jul 17, 2019

Hello @freekmurze

It's a a specific project, It's a basic test case demonstrating a bug, actually it is failing test.

use Spatie\Image\Image;
use Spatie\Image\Manipulations;

$images = [
	__DIR__ . '/src/08/image.jpg',
	__DIR__ . '/src/10/image.jpg',
];

foreach($images as $image) {
	$file_name = pathinfo($image, PATHINFO_FILENAME);
	$file_ext = pathinfo($image, PATHINFO_EXTENSION);
	$hash = md5($image);
	Image::load($image)
		->setTemporaryDirectory(__DIR__ . '/tmp')
		->sepia()
		->apply()
		->crop(Manipulations::CROP_CENTER, 100, 100)
	->save('dist/' . $file_name . '-' . $hash . '.' . $file_ext);
}

I'm not very confortable at unit testing but i'll try to PR something.

nlemoine added a commit to nlemoine/image that referenced this issue Jul 17, 2019

nlemoine added a commit to nlemoine/image that referenced this issue Jul 17, 2019

nlemoine added a commit to nlemoine/image that referenced this issue Jul 17, 2019

nlemoine added a commit to nlemoine/image that referenced this issue Jul 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.