Search Results

Search found 20 results on 1 pages for 'gd2'.

Page 1/1 | 1 

  • Letter placement error with GD2, TTF and PHP

    - by Javier Parra
    Some time ago I made a script that takes some text and returns it as an image, and worked flawlessly. But I'm not sure since when a weird bug started to happen. The letters that have a (my apologies to the font geeks) "glyph" on the left get pushed to the right so the letter starts on it, but leaves space only for the main letter, hehe, I think an example should do it. The expected result is: The "bad" one was generated, obviously, by my script, located here: http://www.esbasura.com/images/text.php?txt=The%20quick%20brown%20fox%20jumps%20over%20the%20lazy%20dog.&fnt=1&size=23&bg=lightgrey And the good one was generated by dafont here: http://img.dafont.com/preview.php?text=The%20quick%20brown%20fox%20jumps%20over%20the%20lazy%20dog.&ttf=bleeding_cowboys0&ext=1&size=23&psize=m&y=46 I'm not doing anything fancy in the script, here is the relevant part: imagefilledrectangle($im, 0, 0, $width, $height, $$bg); imagettftext($im, $size, 0, (-1*$textsize[6]), (-1*$textsize[7]), $$color, $font, $text); // imagefttext($im, $size, 0, (-1*$textsize[6]), (-1*$textsize[7]), $$color, $font, $text); same results using imagefttext imagecolortransparent($im, $$bg); header("Cache-Control: public"); // HTTP/1.1 header("Content-type: image/png"); imagepng($im); imagedestroy($im); } I'm kind of surprised, because, as I said, it used to work flawlessly. Maybe my host changed my machine. (here's my phpinfo: http://www.work4bandwidth.com/info.php) Relevant bit: gd GD Support enabled GD Version bundled (2.0.34 compatible) FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.2.1 GIF Read Support enabled GIF Create Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled XBM Support enabled

    Read the article

  • Improving Performance on this Image Creation function

    - by Abs
    Hello all, I am making use of GD2 and the image functions to take in a string and then convert that into an image using different fonts at different sizes. The function I use is below. Currently, its pretty quick but not quick enough. The function gets called about 20 times per user and the images generated are always new ones (different) so caching isn't going to help! I was hoping to get some ideas on how to make this function faster. Maybe supply more RAM to the script running? Anything else that is specific to this PHP function? Anything else that I can do to tweak performance of this function? function generate_image($save_path, $text, $font_path, $font_size){ $font = $font_path; /* * I have simplifed the line below, its actually a function that works out the size of the box * that is need for each image as the image size is different based on font type, font size etc */ $measure = array('width' => 300, 'height'=> 120); if($measure['width'] > 900){ $measure['width'] = 900; } $im = imagecreatetruecolor($measure['width'], $measure['height']); $white = imagecolorallocate($im, 255, 255, 255); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, $measure['width'], $measure['height'], $white); imagettftext($im, $font_size, 0, $measure['left'], $measure['top'], $black, $font, ' '.$text); if(imagepng($im, $save_path)){ $status = true; }else{ $status = false; } imagedestroy($im); return $status; } Thanks all for any help

    Read the article

  • How do i resize image file to optional sizes

    - by shuxer
    Hi I have image upload form, user attaches aimage file, and selects image size to resize the uploaded image file(200kb, 500kb, 1mb, 5mb, Original). Then my script needs to resize image file size based on user's optional size, but im not sure how to implement this feature, For example, user uploads image with one 1mb size, and if user selects 200KB to resize, then my script should save it with 200kb size. Does anyone know or have an experience on similar task ? Thanks for you reply in advance.

    Read the article

  • Enable GD support in PHP

    - by Don
    Hi, I'm trying to install pixelpost on an Apache server on windows. The installer is failing because: Pixelpost will not run if your PHP installation is not compiled with the GD graphics library. I've added the following line to php.ini extension=php_gd2.dll But I still get the same error message. When I run phpinfo() I don't see any reference to GD, so I guess it really isn't installed. I searched for php_gd2.dll and it's in the ext subfolder of my PHP root dir. I know nothing about PHP, so be gentle with me. Thanks, Don

    Read the article

  • python: os.system does not execute shell comand

    - by capoluca
    I need to execute shell command in python program (I have ubuntu). More specifically I want to create graph using graphviz in python script. My code is os.system("dot -Tpng graph.dot -o graph.png") It does not work, but if I just type dot -Tpng graph.dot -o graph.png in command line then everything is fine. Do you know what the problem? Thank you! Edit: Does not work means that nothing happens, there are no errors. Output from dot -v -Tpng graph.dot -o graph.png: dot - graphviz version 2.26.3 (20100126.1600) Activated plugin library: libgvplugin_pango.so.6 Using textlayout: textlayout:cairo Activated plugin library: libgvplugin_dot_layout.so.6 Using layout: dot:dot_layout Using render: cairo:cairo Using device: png:cairo:cairo The plugin configuration file: /usr/lib/graphviz/config6 was successfully loaded. render : cairo dot fig gd map ps svg tk vml vrml xdot layout : circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi textlayout : textlayout device : canon cmap cmapx cmapx_np dot eps fig gd gd2 gif gv imap imap_np ismap jpe jpeg jpg pdf plain plain-ext png ps ps2 svg svgz tk vml vmlz vrml wbmp x11 xdot xlib loadimage : (lib) eps gd gd2 gif jpe jpeg jpg png ps svg

    Read the article

  • setting library include paths in c++

    - by Drew
    Hi all, I just installed gd2 using mac ports (sudo install gd2), which installed libraries in the following places: /opt/local/include/gd.h /opt/local/lib/libgd.dylib (link) /opt/local/lib/libgd.la /opt/local/lib/libgd.a So when I create my c++ app I add '#include "gd.h"', which throws: main.cpp:4:16: error: gd.h: No such file or directory If I set gd.h as an absolute path (as above)(not a solution, but was curious), I am thrown: g++ -L/opt/local/include -L/opt/local/lib main.o Heatmap_Map.o Heatmap_Point.o -o heatmap Undefined symbols: "_gdImagePng", referenced from: _main in main.o "_gdImageLine", referenced from: _main in main.o "_gdImageColorAllocate", referenced from: _main in main.o _main in main.o "_gdImageDestroy", referenced from: _main in main.o "_gdImageCreate", referenced from: _main in main.o "_gdImageJpeg", referenced from: _main in main.o ld: symbol(s) not found So, I understand this means that ld can not find the libraries it needs (hence trying to give it hints with the "-L" values). So after giving g++ the -L hints and the absolute path in #include, I can get it to work, but I don't think I have to do this, how can I make g++/ld search int eh right places for the libraries? Drew J. Sonne.

    Read the article

  • php,imageresizing

    - by tismon
    function rezizecode() { $config['image_library'] = 'gd2'; $config['source_image'] = 'system/application/images/manu.jpg'; $config['create_thumb'] = TRUE; $config['maintain_ratio'] = TRUE; $config['width']= 25; $config['height']= 30; $this->load->library('image_lib', $config); $this->image_lib->resize(); } using this code image resizing is not working ?

    Read the article

  • CodeIgniter crop() without maintain_ration

    - by Mango
    I have this function above witch even maintain_ration set false, cutting with this proportion. I just want crop without ratio. function do_crop() { $config = array( 'image_library' => 'gd2', 'source_image' => realpath(APPPATH . '../upload_img/solg6.jpg'), 'new_image' => $this->gallery_path_url . 'thumbaaa.jpg', 'maintain_ration' => false, 'width' => 150, 'height' => 150, 'x_axis' => 20, 'y_axis' => 20 ); $this->load->library('image_lib'); $this->image_lib->initialize($config); if ( ! $this->image_lib->crop()) { echo $this->image_lib->display_errors(); } $this->image_lib->clear(); }

    Read the article

  • Problem resizing image using Code Ignitor1.7.3

    - by Yashwant Chavan
    Following is the code which resize the image, but here i am not able to resize the image function processHome(){ $this->load->library('image_lib'); $img_path = base_url().'img/image/50X50/ori.jpeg'; $config['image_library'] = 'gd2'; $config['source_image'] = $img_path; $config['create_thumb'] = TRUE; $config['maintain_ratio'] = TRUE; $config['width'] = 50; $config['height'] = 50; $this->load->library('image_lib', $config); $this->image_lib->resize(); if ( ! $this->image_lib->resize()){ echo $this->image_lib->display_errors(); } echo "No error"; exit; $this->load->view('index', $data); }

    Read the article

  • i don't receive mail notification...Nagios Core 4

    - by alessio
    I have a problem with automatically mail notification in Nagios Core 4 installed on ubuntu 12 .04 lts server... i have tried to send mail with nagios user and root user with the command: echo "test" | mail -s "test mail" [email protected] and i received mail correctly... but i don't receive any automatically mail notification... i don't know how can i do to resolve this issue! :( these are my configuration files (commands.cfg, contacts.cfg, nagios.log, mail.log): commands.cfg (the path /usr/bin/mail is the right path): # 'notify-host-by-email' command definition define command{ command_name notify-host-by-email command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$ } # 'notify-service-by-email' command definition define command{ command_name notify-service-by-email command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ } # 'process-host-perfdata' command definition define command{ command_name process-host-perfdata command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out } # 'process-service-perfdata' command definition define command{ command_name process-service-perfdata command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out } contacts.cfg: define contact{ contact_name supporto alias Supporto Clienti DEA service_notification_period 24x7 host_notification_period 24x7 service_notification_options w,u,c,r host_notification_options d,r service_notification_commands notify-service-by-email host_notification_commands notify-host-by-email email [email protected] } define contactgroup{ contactgroup_name admins alias Nagios Administrators members supporto } nagios.log: [1401871412] SERVICE ALERT: fileserver;Current Users;OK;SOFT;2;USERS OK - 1 users currently logged in [1401871953] SERVICE ALERT: backups;Nagios Status;WARNING;SOFT;1;NAGIOS WARNING: 36 processes, status log updated 541 seconds ago [1401872133] SERVICE ALERT: backups;Nagios Status;OK;SOFT;2;NAGIOS OK: 36 processes, status log updated 180 seconds ago [1401872321] SERVICE ALERT: posta;Swap Usage;CRITICAL;SOFT;1;CRITICAL - Plugin timed out after 10 seconds [1401872322] SERVICE ALERT: fileserver;Current Users;CRITICAL;SOFT;1;CRITICAL - Plugin timed out after 10 seconds [1401872420] SERVICE ALERT: archivio;Disk Space;CRITICAL;SOFT;1;CRITICAL - Plugin timed out after 10 seconds [1401872492] SERVICE ALERT: fileserver;Current Users;OK;SOFT;2;USERS OK - 1 users currently logged in [1401872492] SERVICE ALERT: posta;Swap Usage;OK;SOFT;2;SWAP OK: 100% free (1984 MB out of 1984 MB) [1401872590] SERVICE ALERT: archivio;Disk Space;OK;SOFT;2;DISK OK [1401872931] Auto-save of retention data completed successfully. [1401873333] SERVICE ALERT: backups;Nagios Status;WARNING;SOFT;1;NAGIOS WARNING: 36 processes, status log updated 402 seconds ago [1401873513] SERVICE ALERT: backups;Nagios Status;OK;SOFT;2;NAGIOS OK: 36 processes, status log updated 180 seconds ago mail.log (i think that the problem is here but i don't know how to resolve it): Jun 4 10:00:01 backups sm-msp-queue[6109]: My unqualified host name (backups) unknown; sleeping for retry Jun 4 10:01:01 backups sm-msp-queue[6109]: unable to qualify my own domain name (backups) -- using short name Jun 4 10:20:01 backups sm-msp-queue[7247]: My unqualified host name (backups) unknown; sleeping for retry Jun 4 10:21:01 backups sm-msp-queue[7247]: unable to qualify my own domain name (backups) -- using short name Jun 4 10:40:01 backups sm-msp-queue[8327]: My unqualified host name (backups) unknown; sleeping for retry Jun 4 10:41:01 backups sm-msp-queue[8327]: unable to qualify my own domain name (backups) -- using short name Jun 4 11:00:01 backups sm-msp-queue[9549]: My unqualified host name (backups) unknown; sleeping for retry Jun 4 11:01:01 backups sm-msp-queue[9549]: unable to qualify my own domain name (backups) -- using short name Jun 4 11:20:01 backups sm-msp-queue[10678]: My unqualified host name (backups) unknown; sleeping for retry Jun 4 11:21:01 backups sm-msp-queue[10678]: unable to qualify my own domain name (backups) -- using short name i'm at the last step and i want to finish this Nagios Core! :) Any help be appreciate!:) host definition (this host have the disk almost full and it is in hard state but non notification) : define host{ use generic-host ; Name of host template to use host_name posta alias Server Posta ESA address 10.10.2.102 parents xen1, xen2 icon_image redhat.png statusmap_image redhat.gd2 } service definition: define service{ use generic-service host_name xen1, maestro, xen2, posta, nas002, serv2, esasrvmi02, esaubuntumi service_description Disk Space check_command ssh_all_disks!10%!5% } Notification is allowed for the contact definition you gave, but is it also allowed at the the service level ? sorry but i don't understand this thing! :(

    Read the article

  • Codeigniter image manipulation class rotates image during resize

    - by someoneinomaha
    I'm using Codeigniter's image manipulation library to re-size an uploaded image to three sizes, small, normal and large. The re-sizing is working great. However, if I'm resizing a vertical image, the library is rotating the image so it's horizontal. These are the config settings I have in place: $this->resize_config['image_library'] = 'gd2'; $this->resize_config['source_image'] = $this->file_data['full_path']; $this->resize_config['maintain_ratio'] = TRUE; // These change based on the type (small, normal, large) $this->resize_config['new_image'] = './uploads/large/'.$this->new_file_name.'.jpg'; $this->resize_config['width'] = 432; $this->resize_config['height'] = 288; I'm not setting the master_dim property because the default it set to auto, which is what I want. My assumption is that the library would take a vertical image, see that the height is greater than the width and translate the height/width config appropriately so the image remains vertical. What is happening (apparently) is that the library is rotating the image when it is vertical and sizing it per the configuration. This is the code in place I have to do the actual re-sizing: log_message('debug', 'attempting '.$size.' photo resize'); $this->CI->load->library('image_lib'); $this->CI->image_lib->initialize($this->resize_config); if ($this->CI->image_lib->resize()) { $return_value = TRUE; log_message('debug', $size.' photo resize successful'); } else { $this->errors[] = $this->CI->image_lib->display_errors(); log_message('debug', $size.' photo resize failed'); } $this->CI->image_lib->clear(); return $return_value;

    Read the article

  • GHC 6.12 and MacPorts

    - by absz
    I recently installed GHC 6.12 and the Haskell Platform 2010.1.0.1 on my Intel MacBook running OS X 10.5.8, and initially, everything worked fine. However, I discovered that if I use cabal install to install a package which depends on a MacPorts library (e.g., cabal install --extra-lib-dirs=/opt/local/lib --extra-include-dirs=/opt/local/include gd), things work fine in GHCi, but if I try to compile, I get the error Linking test ... Undefined symbols: "_iconv_close", referenced from: _hs_iconv_close in libHSbase-4.2.0.0.a(iconv.o) "_iconv", referenced from: _hs_iconv in libHSbase-4.2.0.0.a(iconv.o) "_iconv_open", referenced from: _hs_iconv_open in libHSbase-4.2.0.0.a(iconv.o) ld: symbol(s) not found collect2: ld returned 1 exit status After some Googling, I found a long Haskell-cafe thread discussing this problem. The upshot seems to be that MacPorts installs an updated version of libiconv, and the binary interface is slightly different from the version included with the system. Consequently, if you try to link with any MacPorts library, the MacPorts libiconv gets linked in too; and since the base library was built to link against a different version of libiconv, things break. I've tried setting LD_LIBRARY_PATH and DYLD_LIBRARY_PATH and adding more flags to try to get it to look at /usr/lib again (e.g. cabal install --extra-lib-dirs=/opt/local/lib --extra-include-dirs=/opt/local/include --extra-lib-dirs=/usr/lib --extra-include-dirs=/usr/include gd), but neither worked. Uninstalling the MacPorts libiconv isn't really an option, since I have a bunch of ports installed which depend on it---including some ports I want Haskell to link to, like gd2. From what I've seen online, the upshot really seems to be "you're boned": you cannot link against any MacPorts library while compiling with GHC, and there doesn't seem to be a solution. However, that thread was from the end of 2009, so I figure there's a chance that someone has a solution, workaround, ridiculous hack… anything, really. So: does anybody know how to get GHC 6.12 to link against the system libiconv at the same time as it links to libraries from MacPorts? Or, failing that, a way to make linking not break in some other clever way?

    Read the article

  • Missing chars in JpGraph

    - by Álvaro G. Vicario
    I have a web site that runs on Windows and uses cp1252 (aka Win-1252) so it can display Spanish characters. The app generates some plots with JpGraph 2.3. These plots use the Tahoma Open Type font family to display text labels. Strings are provided in ANSI (i.e., cp1252) and font files support cp1252 (actually, the *.ttf files were copied from the system's font folder). It's been working fine in several setups from PHP/5.2.6 to PHP/5.3.0. Problems started when I ran the app under PHP/5.3.1: all non-ASCII are replaced by the hollow rectangle that represents missing or unknown chars. JpGraph's documentation is not very precise about how it expects international chars. Apparently, text is handled internally by the imagettftext() function, which expects UTF-8. However, encoding everything as UTF-8 breaks the app in all the systems. Where ANSI used to work fine, I get wrong characters (Ê instead of Ú). Where I got missing chars, now I get a PHP error: Warning: imagettftext(): any2eucjp(): something happen Do you have any clue about what changed in GD2 from PHP/5.3.0 to 5.3.1 that could be affecting the rendering on non-ASCII chars? How am I expected to feed JpGraph with strings in the Win-1252 charset?

    Read the article

  • jquerycropping,codiegniter,php

    - by user345804
    I want to crop the image using jquery,codigniter in jquery i get four coordinate of image x1=249 x2=326 y1=194 y2=271 w=77 h=77 in codiegniter done the query function do_crop() { $x=249; $y=194; $w=77; $h=77; $path= 'system/application/'; $config = array( 'image_library' => 'gd2', 'source_image' => $path.'/jag1/flowers.jpg' , 'new_image' => $path.'/jag2/flowers.jpg', 'maintain_ration' => false, 'width' => $w, 'height' => $h, 'x_axis' => $x, 'y_axis' => $y ); $this->load->library('image_lib'); $this->image_lib->initialize($config); if ( ! $this->image_lib->crop()) { echo $this->image_lib->display_errors(); } $this->image_lib->clear(); } i get cropped image. But problem is don't get exact cropped image x,y coordinate problem

    Read the article

  • My PNG has transparency, but after saving with PHP GD, transparency is lost [closed]

    - by Harry Stroker
    I found the solution to my problem. See below the original post and completely at the bottom my solution. I made a stupid mistake :) First I crop an image and then save it to a png file. Right after this, I also show the image. However, the saved png does not have transparency and the shown one has. What is going on? $this->resource = imagecreatefrompng($this->url); imagealphablending($this->resource, false); imagesavealpha($this->resource, true); $newResource = imagecreatetruecolor($destWidth, $destHeight); imagealphablending($newResource, false); imagesavealpha($newResource, true); $resample = imagecopyresampled($newResource,$this->resource,0,0,$srcX1,$srcY1,$destWidth,$destHeight,$srcX2-$srcX1, $srcY2-$srcY1); imagedestroy($this->resource); $this->resource = $newResource; // SAVING imagepng($this->resource, $destination, 100); // SHOWING header('Content-type: image/png'); imagepng($this->resource); The reason I also save the image is for caching. If the script is executed on a png, it saves a cached png. Next time the image is requested, the png file will be shown, but it has lost its transparency. Even stranger: When I save that cached png image as (within Firefox), it saves it suddenly as a jpg, even though the extension was png. Downloading the cached png using chrome and opening it in Photoshop gives the error: "file-format module cannot parse the file". I will show you the shown PNG and the generated PNG: http://www.foodmuseum.nl/SaveProblemTransparency.png Once I try to show that saved PNG with the GD library, it gives me an error. EDIT NO NO NO NO THIS IS NOT A DUPLICATE!!!... I ALREADY USED THEIR SOLUTION. The solution in the supposedly duplicate works for showing my image. But I also try to save it with the exact same resource, but then it has no transparency. EDIT 2 - SOLUTION I found out what the problem was. It was a stupid mistake. The script I provided above were cut out of a class and placed as sequential code, while in real this is not what exactly happened. The save image function: function saveImage($destination,$quality = 90) { $this->loadResource(); switch($extension){ default: case 'JPG': case 'jpg': imagejpeg($this->resource, $destination, $quality); break; case 'gif': imagegif($this->resource, $destination); break; case 'png': imagepng($this->resource, $destination); break; case 'gd2': imagegd2($this->resource, $destination); break; } } However... $extension does not exist. I fixed it by adding: $extension = $this->getExtension($destination);

    Read the article

  • PHP Image resize - Why is the image uploaded but not resized?

    - by Hans
    BACKGROUND I have a script to upload an image. One to keep the original image and one to resize the image. 1. If the image dimensions (width & height) are within max dimensions I use a simple "copy" direct to folder UserPics. 2. If the original dimensions are bigger than max dimensions I want to resize the width and height to be within max. Both of them are uploading the image to the folder, but in case 2, the image will not be resized. QUESTION Is there something wrong with the script? Is there something wrong with the settings? SETTINGS Server: WAMP 2.0 PHP: 5.3.0 PHP.ini: GD2 enabled, Memory=128M (have tried 1000M) Tried imagetypes uploaded: jpg, jpeg, gif, and png (same result for all of them) SCRIPT //Uploaded image $filename = stripslashes($_FILES['file']['name']); //Read filetype $i = strrpos($filename,"."); if (!$i) { return ""; } $l = strlen($filename) - $i; $extension = substr($filename,$i+1,$l); $extension = strtolower($extension); //New picture name = maxid+1 (from database) $query = mysql_query("SELECT MAX(PicId) AS number FROM userpictures"); $row = mysql_fetch_array($query); $imagenumber = $row['number']+1; //New name of image (including path) $image_name=$imagenumber.'.'.$extension; $newname = "UserPics/".$image_name; //Check width and height of uploaded image list($width,$height)=getimagesize($uploadedfile); //Check memory to hold this image (added only as checkup) $imageInfo = getimagesize($uploadedfile); $requiredMemoryMB = ( $imageInfo[0] * $imageInfo[1] * ($imageInfo['bits'] / 8) * $imageInfo['channels'] * 2.5 ) / 1024; echo $requiredMemoryMB."<br>"; //Max dimensions that can be uploaded $maxwidth = 20; $maxheight = 20; // Check if dimensions shall be original if ($width > $maxwidth || $height > $maxheight) { //Make jpeg from uploaded image if ($extension=="jpg" || $extension=="jpeg" || $extension=="pjpeg" ) { $modifiedimage = imagecreatefromjpeg($uploadedfile); } elseif ($extension=="png") { $modifiedimage = imagecreatefrompng($uploadedfile); } elseif ($extension=="gif") { $modifiedimage = imagecreatefromgif($uploadedfile); } //Change dimensions if ($width > $height) { $newwidth = $maxwidth; $newheight = ($height/$width)*$newwidth; } else { $newheight = $maxheight; $newwidth = ($width/$height)*$newheight; } //Create new image with new dimensions $newdim = imagecreatetruecolor($newwidth,$newheight); imagecopyresized($newdim,$modifiedimage,0,0,0,0,$newwidth,$newheight,$width,$height); imagejpeg($modifiedimage,$newname,60); // Remove temp images imagedestroy($modifiedimage); imagedestroy($newdim); } else { // Just add picture to folder without resize (if org dim < max dim) $newwidth = $width; $newheight = $height; $copied = copy($_FILES['file']['tmp_name'], $newname); } //Add image information to the MySQL database mysql_query("SET character_set_connection=utf8", $dbh); mysql_query("INSERT INTO userpictures (PicId, Picext, UserId, Width, Height, Size) VALUES('$imagenumber', '$extension', '$_SESSION[userid]', '$newwidth', '$newheight', $size)")

    Read the article

  • CodePlex Daily Summary for Friday, January 28, 2011

    CodePlex Daily Summary for Friday, January 28, 2011Popular ReleasesVFPX: VFP2C32 2.0.0.8 Release Candidate: This release includes several bugfixes, new functions and finally a CHM help file for the complete library.EnhSim: EnhSim 2.3.3 ALPHA: 2.3.3 ALPHAThis release supports WoW patch 4.06 at level 85 To use this release, you must have the Microsoft Visual C++ 2010 Redistributable Package installed. This can be downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=A7B7A05E-6DE6-4D3A-A423-37BF0912DB84 To use the GUI you must have the .NET 4.0 Framework installed. This can be downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9cfb2d51-5ff4-4491-b0e5-b386f32c0992 - Added back in a p...DB>doc for Microsoft SQL Server: 1.0.0.0: Initial release Supported output HTML WikiPlex markup Raw XML Supported objects Tables Primary Keys Foreign Keys ViewsmojoPortal: 2.3.6.1: see release notes on mojoportal.com http://www.mojoportal.com/mojoportal-2361-released.aspx Note that we have separate deployment packages for .NET 3.5 and .NET 4.0 The deployment package downloads on this page are pre-compiled and ready for production deployment, they contain no C# source code. To download the source code see the Source Code Tab I recommend getting the latest source code using TortoiseHG, you can get the source code corresponding to this release here.Office Web.UI: Alpha preview: This is the first alpha release. Very exciting moment... This download is just the demo application : "Contoso backoffice Web App". No source included for the moment, just the app, for testing purposes and for feedbacks !! This package includes a set of official MS Office icons (143 png 16x16 and 132 png 32x32) to really make a great app ! Please rate and give feedback ThanksParallel Programming with Microsoft Visual C++: Drop 6 - Chapters 4 and 5: This is Drop 6. It includes: Drafts of the Preface, Introduction, Chapters 2-7, Appendix B & C and the glossary Sample code for chapters 2-7 and Appendix A & B. The new material we'd like feedback on is: Chapter 4 - Parallel Aggregation Chapter 5 - Futures The source code requires Visual Studio 2010 in order to run. There is a known bug in the A-Dash sample when the user attempts to cancel a parallel calculation. We are working to fix this.Catel - WPF and Silverlight MVVM library: 1.1: (+) Styles can now be changed dynamically, see Examples application for a how-to (+) ViewModelBase class now have a constructor that allows services injection (+) ViewModelBase services can now be configured by IoC (via Microsoft.Unity) (+) All ViewModelBase services now have a unit test implementation (+) Added IProcessService to run processes from a viewmodel with directly using the process class (which makes it easier to unit test view models) (*) If the HasErrors property of DataObjec...NodeXL: Network Overview, Discovery and Exploration for Excel: NodeXL Excel Template, version 1.0.1.160: The NodeXL Excel template displays a network graph using edge and vertex lists stored in an Excel 2007 or Excel 2010 workbook. What's NewThis release improves NodeXL's Twitter and Pajek features. See the Complete NodeXL Release History for details. Installation StepsFollow these steps to install and use the template: Download the Zip file. Unzip it into any folder. Use WinZip or a similar program, or just right-click the Zip file in Windows Explorer and select "Extract All." Close Ex...Kooboo CMS: Kooboo CMS 3.0 CTP: Files in this downloadkooboo_CMS.zip: The kooboo application files Content_DBProvider.zip: Additional content database implementation of MSSQL, RavenDB and SQLCE. Default is XML based database. To use them, copy the related dlls into web root bin folder and remove old content provider dlls. Content provider has the name like "Kooboo.CMS.Content.Persistence.SQLServer.dll" View_Engines.zip: Supports of Razor, webform and NVelocity view engine. Copy the dlls into web root bin folder to enable...UOB & ME: UOB ME 2.6: UOB ME 2.6????: ???? V1.0: ???? V1.0 ??Password Generator: 2.2: Parallel password generation Password strength calculation ( Same method used by Microsoft here : https://www.microsoft.com/protect/fraud/passwords/checker.aspx ) Minor code refactoringVisual Studio 2010 Architecture Tooling Guidance: Spanish - Architecture Guidance: Francisco Fagas http://geeks.ms/blogs/ffagas, Microsoft Most Valuable Professional (MVP), localized the Visual Studio 2010 Quick Reference Guidance for the Spanish communities, based on http://vsarchitectureguide.codeplex.com/releases/view/47828. Release Notes The guidance is available in a xps-only (default) or complete package. The complete package contains the files in xps, pdf and Office 2007 formats. 2011-01-24 Publish version 1.0 of the Spanish localized bits.ASP.NET MVC Project Awesome, jQuery Ajax helpers (controls): 1.6.2: A rich set of helpers (controls) that you can use to build highly responsive and interactive Ajax-enabled Web applications. These helpers include Autocomplete, AjaxDropdown, Lookup, Confirm Dialog, Popup Form, Popup and Pager the html generation has been optimized, the html page size is much smaller nowFacebook Graph Toolkit: Facebook Graph Toolkit 0.6: new Facebook Graph objects: Application, Page, Post, Comment Improved Intellisense documentation new Graph Api connections: albums, photos, posts, feed, home, friends JSON Toolkit upgraded to version 0.9 (beta release) with bug fixes and new features bug fixed: error when handling empty JSON arrays bug fixed: error when handling JSON array with square or large brackets in the message bug fixed: error when handling JSON obejcts with double quotation in the message bug fixed: erro...Microsoft All-In-One Code Framework: Visual Studio 2008 Code Samples 2011-01-23: Code samples for Visual Studio 2008MVVM Light Toolkit: MVVM Light Toolkit V3 SP1 (3): Instructions for installation: http://www.galasoft.ch/mvvm/installing/manually/ Includes the hotfix templates for Windows Phone 7 development. This is only relevant if you didn't already install the hotfix described at http://blog.galasoft.ch/archive/2010/07/22/mvvm-light-hotfix-for-windows-phone-7-developer-tools-beta.aspx.Community Forums NNTP bridge: Community Forums NNTP Bridge V42: Release of the Community Forums NNTP Bridge to access the social and anwsers MS forums with a single, open source NNTP bridge. This release has added some features / bugfixes: Bugfix: Decoding of Subject now also supports multi-line subjects (occurs only if you have very long subjects with non-ASCII characters)Minecraft Tools: Minecraft Topographical Survey 1.3: MTS requires version 4 of the .NET Framework - you must download it from Microsoft if you have not previously installed it. This version of MTS adds automatic block list updates, so MTS will recognize blocks added in game updates properly rather than drawing them in bright pink. New in this version of MTS: Support for all new blocks added since the Halloween update Auto-update of blockcolors.xml to support future game updates A splash screen that shows while the program searches for upd...StyleCop for ReSharper: StyleCop for ReSharper 5.1.14996.000: New Features: ============= This release is just compiled against the latest release of JetBrains ReSharper 5.1.1766.4 Previous release: A considerable amount of work has gone into this release: Huge focus on performance around the violation scanning subsystem: - caching added to reduce IO operations around reading and merging of settings files - caching added to reduce creation of expensive objects Users should notice condsiderable perf boost and a decrease in memory usage. Bug Fixes...New ProjectsAgilErp: AgilErp is a .NET OpenSource ERP - System developed in C# using WPF, WCF ,Entity Framework, MS-SQL-Server and MVVM. Angel Eye: 3d Game for the new generation AWWWE Browser: AWWWE Browser. (Pronounced "awe".) Aural World Wide Web Everywhere. 1) An aural browser. It talks and listens to you and you talk and listen to it. 2) A VUI for normal HTML web sites. It lets regular web sites talk and listen to you while you talk and listen to them.BitLocker Wrapper Library: The BDE Wrapper library allows .NET Developers to quickly use the WMI BitLocker provider without having to learn the complex methods and operation of the WMI classes.CRM8000: CRM8000????????????????DSM Hub for WP7: Implements a light version of the DSM tools for WP7. Currently, most of the effort is on the audio station.File Downloader: This application checks a Gmail account regularly for mail containing URLs. Once a URL is found, its content is downloaded and sent as a reply message with the file as an attachment. Intended usage: - Download IEEE articles as PDF when you're not in a authenticated network.Folder Space Quota: This component return Quotas Disk Space used for each folders and subfolders in a given directory. Results are returned with a graphic percent bar. Another Tab give access to this directory tree, indicating the size of each file and allows previewing them in a "LightBox" window. IDK: Every other month, IDK asks people to come up with awesome ideas for new programs and webpages. After the end of the month, IDKs developers have another month to create one of the top rated websites or applications. Got a great idea for a new app? Let IDK build it for you.Interop 2: Microformats for Azure Cloud with OData-InterfacejSPoint - JavaScript Library for SharePoint: JavaScript for SharePoint (jSPoint) is a library that help SharePoint developers to create rich,dynamic, & powerfull pages for SharePoint sites.MVVM T4: T4 Templates for generating view models, and views for WPF, Silverlight, Windows Phone using T4 Toolbox and MVVM LightNumericUpDown Control for WPF: A basic NumericUpDown Control for WPF that mirrors all the most used functions of the WinForms NumericUpDown Control and looks similar to itOData for IQToolkit: OData for IQToolkit, converts OData expressions into a usable expressions for IQToolkit providers.PLATO: PALTO is micro plate processing pipeline and supports enzymes and metabolites. PLATO was developed at INRA-Bordeaux and is an evolution of the EnzymeLaborTool developed at the Max-Planck Institute of Molecular Plant Physiology.Purdue CS 490: Model-based testing of ADO.NET: Five students from Purdue University will develop model-based tests for an aspect of ADO.NET during the Spring 2011 semester. We'll be using C# and Spec Explorer, among other tools.Replace in multiple Office 2010 documents: This program replaces a text string in multiple office 2010 documents (Word, Excel, PowerPoint). It is developed in VB.NET and new code for additional products is welcome. SearchEngine: A Website Search Engine and Crawler.Set Custom Currency Symbol: This utility enables you to set/register custom currency symbols for the .NET FrameworkSimple C# Email Templates: A really simple, really easy to use class for sending email templates. Reads any file from disk (think ".txt" or ".html") and matches custom tokens with the values you supply, in both the message body and the subject line. Supports multiple CC and BCC addresses.SimpleBasicAuthentication: SimpleBasicAuthentication makes it easier for developers to build a website with basic authentication using the credentials from just a text file. You'll no longer have to create new users on the system just to let them log in to the website or service. It's developed in C# 4.0.SpecsFor - Yet Another BDD Framework For .NET: SpecsFor is another Behavior-Driven Development framework that focuses on ease of use for *developers* by minimizing testing friction. Square: Custom SharePoint MyProfile PageSynchrolist workflow: Sharepoint workflow whitch perform automatic synchronisation between two lists in the same collection. Usefull for automatic translation.TFS Aggregator: This server side plugin for TFS 2010 enables dynamic calculation of field values in TFS. (For example: Dev work + Test Work = Total Work) Supports same work item and parent-child links. Also has support for aggregating string values (ie Children are Done so the parent is Done)Tinchant: My nice projectZebra_Image, a lightweight image manipulation library written in PHP: This is a compact (one-file only), lightweight, object-oriented image manipulation library written in and for PHP, that provides methods for performing several types of image manipulation operations. It doesn’t require any external libraries other than the GD2 extension.Zebra_Pagination, a generic pagination class written in PHP: A generic pagination class that automatically generates navigation links given the total number of items and the number of items per page.Zebra_Session, a wrapper for PHP’s default session handler, using MySQL: Zebra_Session is a PHP class that acts as a wrapper for PHP’s default session handling functions but instead of storing session data in flat files it stores them in a MySQL database, thus providing both better security and better performance.

    Read the article

1