Afbeelding groter dan => Verkleinen

Gestart doorMarvinn11 reacties25 weergaven

12 berichten · pagina 1 van 1

Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoi.

Ik zoek een script dat als een plaatje groter dan 300x300 is dat hij verkleind naar 300x300.

Want nu heb ik WIDTH=300 HEIGHT=300 maar plaatjes die maar 20x40 zijn worden nu ook 300x300.

Wat is een goede oplossing?sadley
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
CSS

img
{
max-height:300px;
max-width:300px;
}


Jammer genoeg ondersteunen niet alle browsers dit.
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maartenl schreef:
CSS

img
{
max-height:300px;
max-width:300px;
}
Jammer genoeg ondersteunen niet alle browsers dit.

(Het is voor een forum)

Welke browsers niet dan? Weetje dat toevallig?
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nickjexx schreef:
Eerdere citaten tonen
Maartenl schreef:
CSS
img
{
max-height:300px;
max-width:300px;
}


Jammer genoeg ondersteunen niet alle browsers dit.
(Het is voor een forum)

Welke browsers niet dan? Weetje dat toevallig?

Weet het niet, ik test het even.

In firefox werkt het.
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Oke dan gebruik ik dit wel yummie
Mocht iemand anders nog een oplossing hebben graag! Want ik wil dat mijn website alle browsers ondersteund yummie
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
In IE werkt het niet.
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Oeps mijn fout werkt al weer yummie
0
Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je zou het met php kunnen doen.
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maartenl schreef:
In IE werkt het niet.
Hoe kan het ook anders emo
Ik zou het inderdaad met php doen, als je het niet zelf wilt maken moet je zoeken op php thumbnail
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Snap niet veel van dat systeem "sadley
Want het is met img en dan gewoon de url geen upload systeem.
0
Berichten
4.912
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik doe het zo

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]config/settings.php[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](@[/COLOR][URL="http://www.php.net/GetImageSize"]GetImageSize[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]http://www.[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]/uploads/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]img[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700])) {[/COLOR]

[COLOR= #0000BB]$file[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]uploads/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]img[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]img[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/file_exists"]file_exists[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$file[/COLOR][COLOR= #007700])) {[/COLOR]
[COLOR= #0000BB]$width[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]640[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$height[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]500[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/list"]list[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$owidth[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$oheight[/COLOR][COLOR= #007700]) =[/COLOR] [URL="http://www.php.net/getimagesize"]getimagesize[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$file[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$img[/COLOR] [COLOR= #007700]=[/COLOR] imagecreatefromjpeg[COLOR= #007700]([/COLOR][COLOR= #0000BB]$file[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$res[/COLOR] [COLOR= #007700]=[/COLOR] imagecreatetruecolor[COLOR= #007700]([/COLOR][COLOR= #0000BB]$width[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$height[/COLOR][COLOR= #007700]);[/COLOR]
imagecopyresized[COLOR= #007700]([/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$img[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$width[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$height[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$owidth[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$oheight[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Content-Type: image/jpeg[/COLOR][COLOR= #007700]);[/COLOR]
imagejpeg[COLOR= #007700]([/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700]);
}
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]er is geen get[/COLOR][COLOR= #007700]; }
}[/COLOR]
?>
0
Berichten
3.788
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kan je dan niet beter gewoon de afbeelding direct verkleinen met PHP (dus gewoon het bestand zelf), dat lijkt me wat beter voor de server dan steeds dit script te moeten doorlopen
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren