Hi allen,
Ik onderhoud enige tijd een website die naar mijn mening een beetje slecht is gebouwd. Ik onderhoud slechts hetgeen de klant wil, om zo voor hen in kosten te besparen. Zelf ben ik ook weinig onderlegd in PHP.
Zo dateert het image resize script uit 2005 en nu werkt dit ineens niet meer. Het image resize script verkleint de weergave van afbeeldingen zodat ze door middel van url op een bepaalde grootte kunnen worden getoond.
Ik heb de site ook even hier online gezet. Je ziet dat de afbeeldingen niet worden getoond. Als ik de afbeelding op de homepage (in de balk aan de linkerzijde) in een apart tabblad laad, dan krijg je dit te zien:
Line 71 van het php script is dan:Code:Deprecated: Function ereg_replace() is deprecated in /home/weide/domains/tipict.nl/public_html/ontwikkeling5/img.php on line 71 JFIF;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 70 C #%$""!&+7/&)4)!"0A149;>>>%.DIC;C ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;In" ĵ}!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ĵw!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz?H1GMRT85:e fא亘LI'*(6XZjb) cJiיJ]qΩI=}V+Lc1?i>-ѕe ;VłME OUg.W 1b[RܒsM.8ZG\SIe LIcYqq QӞ1]h9LUGV[#UQMkNmhR Gf$c` ӏ\ҵ\ۅvW#XN$DGI,2ȍC,,Vɕse3*t &~_ FOM뷓͞kvB_Ws!f9.vTtF,??QGۍD=p~dVxW6#zIeQgsY{(WG2%YH[[foU&ڶ ϻ=/ Yf ǏL黈yǪ %4G3ȃM9Y wn>B ?|2k~O, P_$XB4?Iϊ%tҤ ֛uEC ?qgqubrkGU (@+i)(ij⎤V՟|1XvٻVY.w;:| 'zh N/Y+1uvGfzҜ4ؔ sՔZCg-C*=}Teƒ;2K56:rJg2>\U6UF}H-I9Nqm#V8GR?ίZXi (Zv#b~@3s4HQOUE<q'N:ڙD[W'5l$?L1KP֑Bc Y%銩j]7K,jΑqUz+s#뺷T#܇.B೮G*ɨelo=nwߒjvI=-1O&sukEJk~{ VFt5}R+o1YR2J4myytҪ+"kGNAc8Ih85|l]6lRDu2#0&sq^w7nאK}#FB&l.>U' *GNP$ QWBբkK2+TzeS1DQ#Pݩ>u8ސ3/;dvZʛ{{c9oc$3[],}kJ]\" lVgk=[m3Fx7f[}QТm{E2TOZи7gҼr\GI*"0{>{Jek&c7 " ̾mU"ZP}Qc,%>>{5h)W(=+wR֜%ȍ'96;\ +y.i;quxG2Z@%`rp1=*$Eq (ĩVIzmAÌ3Xu>ޤƗ[2?0~u&i fW.$A<Vm+(e#zMsw͉n3g9m!I9I?kFLbP˵Aq0H 'ҮCʯA_I} jg۵$}Op}ךji0@r۽slUk`7ߜyu*J/tlch6s,F mĐG=?|E֦ww1I# GQy3/l tfbYln߀\;Q`ZWiE[Jsm.@3m>,B@f8i\oҲuG1U4;U%q W :Y{i2T/EXnQAS.
De hele php van img.php is:Code:$this->img["format"]=ereg_replace(".*\.(.*)$","\\1",$imgfile);
Daarnaast is er een img_show.php actief:Code:<?php ############################################## # Shiege Iseng Resize Class # 11 March 2005 # shiegegeATyahoo.com # http://shiege.com/scripts/thumbnail/ /*############################################ Sample : $thumb=new thumbnail("./shiegege.jpg"); // generate image_file, set filename to resize/resample $thumb->size_width(100); // set width for thumbnail, or $thumb->size_height(300); // set height for thumbnail, or $thumb->size_auto(200); // set the biggest width or height for thumbnail $thumb->jpeg_quality(75); // [OPTIONAL] set quality for jpeg only (0 - 100) (worst - best), default = 75 $thumb->show(); // show your thumbnail $thumb->save("./huhu.jpg"); // save your thumbnail to file ---------------------------------------------- Note : - GD must Enabled - Autodetect file extension (.jpg/jpeg, .png, .gif, .wbmp) but some server can't generate .gif / .wbmp file types - If your GD not support 'ImageCreateTrueColor' function, change one line from 'ImageCreateTrueColor' to 'ImageCreate' (the position in 'show' and 'save' function) - If your GD not support 'ImageCopyResampled' function, change 'ImageCopyResampled' to 'ImageCopyResize' */############################################ class thumbnail { var $img; function thumbnail($imgfile) { //detect image format $this->img["format"]=ereg_replace(".*\.(.*)$","\\1",$imgfile); $this->img["format"]=strtoupper($this->img["format"]); if ($this->img["format"]=="JPG" || $this->img["format"]=="JPEG") { //JPEG $this->img["format"]="JPEG"; $this->img["src"] = ImageCreateFromJPEG ($imgfile); } elseif ($this->img["format"]=="PNG") { //PNG $this->img["format"]="PNG"; $this->img["src"] = ImageCreateFromPNG ($imgfile); } elseif ($this->img["format"]=="GIF") { //GIF $this->img["format"]="GIF"; $this->img["src"] = ImageCreateFromGIF ($imgfile); } elseif ($this->img["format"]=="WBMP") { //WBMP $this->img["format"]="WBMP"; $this->img["src"] = ImageCreateFromWBMP ($imgfile); } else { //DEFAULT echo "Not Supported File"; exit(); } @$this->img["width"] = imagesx($this->img["src"]); @$this->img["height"] = imagesy($this->img["src"]); //default quality jpeg $this->img["quality"]=75; } function size_height($size=100) { //height $this->img["height_thumb"]=$size; @$this->img["width_thumb"] = ($this->img["height_thumb"]/$this->img["height"])*$this->img["width"]; } function size_width($size=100) { //width $this->img["width_thumb"]=$size; @$this->img["height_thumb"] = ($this->img["width_thumb"]/$this->img["width"])*$this->img["height"]; } function size_auto($size=100) { //size if ($this->img["width"]>=$this->img["height"]) { $this->img["width_thumb"]=$size; @$this->img["height_thumb"] = ($this->img["width_thumb"]/$this->img["width"])*$this->img["height"]; } else { $this->img["height_thumb"]=$size; @$this->img["width_thumb"] = ($this->img["height_thumb"]/$this->img["height"])*$this->img["width"]; } } function jpeg_quality($quality=75) { //jpeg quality $this->img["quality"]=$quality; } function show() { //show thumb @Header("Content-Type: image/".$this->img["format"]); /* change ImageCreateTrueColor to ImageCreate if your GD not supported ImageCreateTrueColor function*/ $this->img["des"] = ImageCreateTrueColor($this->img["width_thumb"],$this->img["height_thumb"]); @imagecopyresampled ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["width_thumb"], $this->img["height_thumb"], $this->img["width"], $this->img["height"]); if ($this->img["format"]=="JPG" || $this->img["format"]=="JPEG") { //JPEG imageJPEG($this->img["des"],"",$this->img["quality"]); } elseif ($this->img["format"]=="PNG") { //PNG imagePNG($this->img["des"]); } elseif ($this->img["format"]=="GIF") { //GIF imageGIF($this->img["des"]); } elseif ($this->img["format"]=="WBMP") { //WBMP imageWBMP($this->img["des"]); } } function save($save="") { //save thumb if (empty($save)) $save=strtolower("./thumb.".$this->img["format"]); /* change ImageCreateTrueColor to ImageCreate if your GD not supported ImageCreateTrueColor function*/ $this->img["des"] = ImageCreateTrueColor($this->img["width_thumb"],$this->img["height_thumb"]); @imagecopyresampled ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["width_thumb"], $this->img["height_thumb"], $this->img["width"], $this->img["height"]); if ($this->img["format"]=="JPG" || $this->img["format"]=="JPEG") { //JPEG imageJPEG($this->img["des"],"$save",$this->img["quality"]); } elseif ($this->img["format"]=="PNG") { //PNG imagePNG($this->img["des"],"$save"); } elseif ($this->img["format"]=="GIF") { //GIF imageGIF($this->img["des"],"$save"); } elseif ($this->img["format"]=="WBMP") { //WBMP imageWBMP($this->img["des"],"$save"); } } } ?>
Het vreemde is: ik ben er zeker van dat e.e.a. niet door mijn toedoen fout is gegaan. op ontwikkeling5.tipict.nl staat zelfs een oudere versie waarvan ik zeker weet dat de foto's destijds werkten. Maar ook op de huidige site werken de foto's ineens niet meer. Misschien door een php upgrade van mijn hostingprovider oid?Code:<?php require("img.php"); $imgfile = urldecode($_GET["imgfile"]); if (isset($_GET["width"])) $width = $_GET["width"]; elseif (isset($_GET["height"])) $height = $_GET["height"]; else $width = 50; if (!isset($_GET["quality"])) $quality=60; else $quality = $_GET["quality"]; if (substr($imgfile,0,4) != "http") $imgfile = ".".$imgfile; $thumb=new thumbnail($imgfile); // generate image_file, set filename to resize if (isset($height)) $thumb->size_height($height); // set height for thumbnail, or else $thumb->size_width($width); // set width for thumbnail //$thumb->size_auto(200); // set the biggest width or height for thumbnail $thumb->jpeg_quality($quality); // [OPTIONAL] set quality for jpeg only (0 - 100) (worst - best), default = 75 $thumb->show(); // show your thumbnail ?>
In ieder geval bedankt voor wie de moeite heeft genomen dit door te nemen en duidelijkheid probeert te bieden, dat waardeer ik zeer :-)
- Probleem met image resize script
-
22-07-2013, 21:10 #1gast2012 Guest
Probleem met image resize script
-
-
22-07-2013, 21:37 #2
- Berichten
- 691
- Lid sinds
- 15 Jaar
Re: Probleem met image resize script
Is het al opgelost?
-
22-07-2013, 22:07 #3gast2012 Guest
Re: Probleem met image resize script
Nee, helaas...
-
23-07-2013, 00:10 #4
- Berichten
- 33
- Lid sinds
- 14 Jaar
Re: Probleem met image resize script
Het kan zijn, geen zekerheid, dat de PHP versie gepdate is door de hosting en dat daarom het script plots niet meer werkt.
Indien je hostingprovider PHP naar versie 5.3 heeft gebracht, dan werk de ereg_replace() functie simpelweg niet langer.
Op deze website staat er meer informatie over + er wordt ook een oplossing gegeven voor het probleem.
Hopelijk kan je er mee verder!
-
23-07-2013, 06:58 #5gast2012 Guest
Re: Probleem met image resize script
Ik begrijp het punt, maar ben niet zo behendig met php dat ik het script erop kan aanpassen.. Houd het nog maar even aan, S. van Laere heeft me via de mail een bestandje gestuurd, misschien wil/kan hij me verder helpen. Voordat er straks meerdere mensen tegelijkertijd moeite in steken..
-
24-07-2013, 00:09 #6
- Berichten
- 407
- Lid sinds
- 15 Jaar
Re: Probleem met image resize script
Je kan eens kijken naar het TimThumb script. Dit gebruik ik altijd en het werkt goed.
http://www.binarymoon.co.uk/projects/timthumb/
http://timthumb.googlecode.com/svn/trunk/timthumb.php
-
27-07-2013, 11:37 #7gast2012 Guest
Re: Probleem met image resize script
Iedereen dank voor reacties. Probleem opgelost. Iemand die het script wil hebben kan zich melden via PM!
Plaats een
- + Advertentie
- + Onderwerp
Marktplaats
Webmasterforum
- Websites algemeen
- Sitechecks
- Marketing
- Domeinen algemeen
- Waardebepaling
- CMS
- Wordpress
- Joomla
- Magento
- Google algemeen
- SEO
- Analytics
- Adsense
- Adwords
- HTML / XHTML
- CSS
- Programmeren
- PHP
- Javascript
- JQuery
- MySQL
- Ondernemen algemeen
- Belastingen
- Juridisch
- Grafisch ontwerp
- Hosting Algemeen
- Hardware Info
- Offtopic