Accueil > Forum > > > > redimention d'image...
redimention d'image...
mardi 11 mai 2004 à 13:31:51 |
redimention d'image...

fanfanus
|
J'ai trouvé ce code: <? function redimage($img_src,$dst_w,$dst_h) { // Lit les dimensions de l'image $size = GetImageSize($img_src); $src_w = $size[0]; $src_h = $size[1]; // Teste les dimensions tenant dans la zone $test_h = round(($dst_w / $src_w) * $src_h); $test_w = round(($dst_h / $src_h) * $src_w); // Si Height final non précisé (0) if(!$dst_h) $dst_h = $test_h; // Sinon si Width final non précisé (0) elseif(!$dst_w) $dst_w = $test_w; // Sinon teste quel redimensionnement tient dans la zone elseif($test_h>$dst_h) $dst_w = $test_w; else $dst_h = $test_h;
// Affiche les dimensions optimales echo "WIDTH=".$dst_w." HEIGHT=".$dst_h; } ?>
<IMG SRC="monimage.jpg" <?redimage("monimage.jpg",XX,YY)?>>
|
Et je souhaite l'inserer dans une page en php, pour les avatars... mais ça marche pas ... j'ai fait ça: morceau rajouté //test function redimage($img_src,$dst_w,$dst_h) { // Lit les dimensions de l'image $size = GetImageSize($img_src); $src_w = $size[0]; $src_h = $size[1]; // Teste les dimensions tenant dans la zone $test_h = round(($dst_w / $src_w) * $src_h); $test_w = round(($dst_h / $src_h) * $src_w); // Si Height final non précisé (0) if(!$dst_h) $dst_h = $test_h; // Sinon si Width final non précisé (0) elseif(!$dst_w) $dst_w = $test_w; // Sinon teste quel redimensionnement tient dans la zone elseif($test_h>$dst_h) $dst_w = $test_w; else $dst_h = $test_h;
// Affiche les dimensions optimales echo "WIDTH=".$dst_w." HEIGHT=".$dst_h; } //test fin
|
morceau préexistant for($i = 0; $i < $total_posts; $i++) { $poster_id = $postrow[$i]['user_id']; $poster = ( $poster_id == ANONYMOUS ) ? $lang['Guest'] : $postrow[$i]['username'];
$post_date = create_date($board_config['default_dateformat'], $postrow[$i]['post_time'], $board_config['board_timezone']);
$poster_posts = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Posts'] . ': ' . $postrow[$i]['user_posts'] : '';
$poster_from = ( $postrow[$i]['user_from'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Location'] . ': ' . $postrow[$i]['user_from'] : '';
$poster_joined = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Joined'] . ': ' . create_date($lang['DATE_FORMAT'], $postrow[$i]['user_regdate'], $board_config['board_timezone']) : '';
$poster_avatar = ''; if ( $postrow[$i]['user_avatar_type'] && $poster_id != ANONYMOUS && $postrow[$i]['user_allowavatar'] ) { switch( $postrow[$i]['user_avatar_type'] ) { case USER_AVATAR_UPLOAD: $poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<table width="80" height="98" border="0" cellpadding="0" cellspacing="0"><tr><td background="../images/avatar.gif"><div align="center"> |
morceau ajouté: | <IMG SRC="' . $board_config['avatar_path'] . '/' . $postrow[$i]['user_avatar'] . '" <? redimage("' . $board_config['avatar_path'] . '/' . $postrow[$i]['user_avatar'] . '",10,10)?>> |
</div></td></tr></table>' : ''; break; case USER_AVATAR_REMOTE: $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<table width="80" height="98" border="0" cellpadding="0" cellspacing="0"><tr><td background="../images/avatar.gif"><div align="center"> |
ajouté | <IMG SRC="' . $postrow[$i]['user_avatar'] . '" <? redimage("' . $postrow[$i]['user_avatar'] . '",10,10)?>> |
</div></td></tr></table>' : ''; break; case USER_AVATAR_GALLERY: $poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : ''; break; } }
|
Mais une fois la page affiché, en regardant le html produit, il laisse le <? redimage("avatar.gif",10,10)?> Comment faire ? Fanfan
|
|
mardi 11 mai 2004 à 18:29:10 |
Re : redimention d'image...

Palca_Ulem
|
Essaye-ça : <img src="' . $postrow[$i]['user_avatar'] . " ' . redimage ($postrow[$i]['user_avatar'], 10, 10) . ' />
|
|
|
mardi 11 mai 2004 à 18:47:33 |
Re : redimention d'image...

fanfanus
|
ça marche pas :( Il manquait des ' '
Faudrait pas integrer une condition dans le code lui même ?
|
|
mardi 11 mai 2004 à 18:53:35 |
Re : redimention d'image...

fanfanus
|
et puis je viens de voir ça qui traine sur la page: WIDTH=10 HEIGHT=10WIDTH=8 HEIGHT=10WIDTH=9 HEIGHT=10WIDTH=9 HEIGHT=10WIDTH=9 HEIGHT=10WIDTH=9 HEIGHT=10WIDTH=10 HEIGHT=10WIDTH=9 HEIGHT=10WIDTH=10 HEIGHT=10WIDTH=10 HEIGHT=10WIDTH=9 HEIGHT=10
L'image est bien affichée, j'ai ça: <IMG SRC="images/avatars/1275532879409e88af60d14.gif" /> mais pas de redimention :(
|
|
Cette discussion est classée dans : code, test, avatar, src, dst
Répondre à ce message
Sujets en rapport avec ce message
affichage de vignettes [ par bidoubidou ]
Bonjour a tous, je suis nouveau dans le coin, et dans la programmation tout court, je souhaite générer un affaichage de vignettes à la volée pour un s
utilisation de php-imagick [ par yberges ]
bonjour a tous voila j'ai un soucis avec un script de creation de thumbmon hebergeur ne prend pas le gd mais image magick ....je du mal a trouver des
Problème avec la fonction fctaffichimage [ par gnut ]
Voilà la fonction que j'ai récupéré : [code=php]<?php // ---------------------------------------------------------------------------------------------
Probleme de syntaxe [ par davidcian ]
Voila ce code me per,et de récupérer l'URL d'une image dans ma base de donnée puis de la redimensionner... Mais ca marche pas... En faite le probleme
Probleme d'ecriture [ par davidcian ]
Bon y a du nouveau... //connection a la baseinclude("include/connection.php3"); $id= $_GET['lot'];$sql ="SELECT * FROM appartement w
Probleme chez Free ? [ par softflower ]
Voila j'ai fait une galerie photo en php, j'upload mes photos et genere automatiquement une vignette, le probleme c'est que chez moi en local y a pas
Image trop grande [ par WhiteDwarf ]
Bonjour,Je développe un site et ai une petite gallerie photo collaborative, laquelle a une petite fonction de redimension d'images, mais lorsque les i
Librairie GD [ par ICIoBRa ]
Salut à tous, j'essaye d'utiliser la fonction imagecopymergegray sans succès. J'ai une page vide avec ce code : [code=php]$dest = imagecreatefrompn
Regex compliquée [ par jjth1 ]
Bonjour à tous! Je fais appel à vous car j'ai un problème assez compliqué qui dépasse mes capacités intellectuelles, c'est pourquoi je fais appel à vo
Livres en rapport
|
Derniers Blogs
XNA IS DEAD!XNA IS DEAD! par richardc
Depuis la semaine dernière (et grâce aux TechDays 2012), je me penche activement sur la nouvelle version de Windows, aka Windows 8. Vous me direz, il était temps puisque la première preview date de Septembre dernier.
OK. Remarquez, on n'en est qu'aux...
Cliquez pour lire la suite de l'article par richardc TECHDAYS PARIS 2012 : WINDOWS SERVER "8" QUOI DE 9 !TECHDAYS PARIS 2012 : WINDOWS SERVER "8" QUOI DE 9 ! par ROMELARD Fabrice
Speakers: Fabrice Meillon et Stanislas Quastana Cette session est basée entièrement sur celle donnée lors de la BUILD cet hiver. Il n'y a pas d'ajout d'information en rapport avec cet évènement passé. Windows 8 Server sera intégralem...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice [HTML5] AUTOUR DU W3C : NOUVEAUX STANDARDS ET WEB MOBILE (LILLE)[HTML5] AUTOUR DU W3C : NOUVEAUX STANDARDS ET WEB MOBILE (LILLE) par Gio
Je m'y prends un peu tard je sais, mais bon je suis développeur web et donc hyper fainéant ! Toujours dans le cadre des technologies émergentes, ici HTML5, parce qu'on aime HTML5 chez Wyg , nous seront présent, le vieux ( Aurélien V.) et moi, pour pr...
Cliquez pour lire la suite de l'article par Gio [WP7] DYNAMICALLY CHANGE STARTUP PAGE[WP7] DYNAMICALLY CHANGE STARTUP PAGE par KooKiz
Let's say that you want to allow the user to customize the startup page of your application. You can easily change the startup page by editing the 'NavigationPage' attribute in the manifest file. But the manifest cannot be modified once the applicatio...
Cliquez pour lire la suite de l'article par KooKiz
Forum
CHAMPS TIMECHAMPS TIME par vargas
Cliquez pour lire la suite par vargas
Logiciels
DocTranslate (V3.1.0.0)DOCTRANSLATE (V3.1.0.0)DocTranslate est un traducteur de document Microsoft Word, PowerPoint et Excel. Il permet d'autom... Cliquez pour télécharger DocTranslate Tribler (2012)TRIBLER (2012)Tribler est un client pair à pair (P2P/Peer-to-Peer) open source avec la capacité de regarder des... Cliquez pour télécharger Tribler OneSwarm (2012)ONESWARM (2012)Le peer-to-peer qui protège votre vie privée, c'est OneSwarm.
Ce logiciel de peer-to-peer crypté... Cliquez pour télécharger OneSwarm PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System
|