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

[feature][suggestion] Scale image for console.image #21

Open
guillaumegarcia13 opened this issue Jul 22, 2020 · 1 comment
Open

[feature][suggestion] Scale image for console.image #21

guillaumegarcia13 opened this issue Jul 22, 2020 · 1 comment

Comments

@guillaumegarcia13
Copy link

I have seen console.image takes scale as second argument but it has not the "expected" result as it is cropping the image instead of resizing it.

image

PS: I too experienced the duplicate image as described in #19

@SOKHUONG
Copy link

If you don't use cdn, you could edit the script.

  1. Find
    (this.width*r,this.height*r) in console.image.min.js and change it to (this.width*r,this.height*r/2)
    OR
  2. Find
    var dim = getBox(this.width * scale, this.height * scale);

in console.image.js and change it to

    var dim = getBox(this.width * scale, this.height * scale / 2);

index.html

<!DOCTYPE html>
<html>
<head>
    <title>console.image</title>
</head>
<body>
	<div class="wrapper">
		<h1>console.image playground. Hit Ctrl/CMD + Shift + J and check it out.</h1>
	</div>

</body>
<!-- <script src="console.image.js" type="text/javascript"></script> -->
<script src="console.image.min.js" type="text/javascript"></script>
<script type="text/javascript">
	// console.image("http://i.imgur.com/oGiMR.gif");
	console.image("https://www.google.fr/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png");
	console.image("https://media.giphy.com/media/g9582DNuQppxC/giphy.gif", 0.8);
	console.meme("🙄","😆","https://media.giphy.com/media/g9582DNuQppxC/giphy.gif", 400, 400); 
</script>
</html>

image

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants