Halaman

Tampilkan postingan dengan label php. Tampilkan semua postingan
Tampilkan postingan dengan label php. Tampilkan semua postingan

Senin, 01 Juli 2013

[Wordpress]problem of wordpress post thumbnail images not resized correctly

Let's open the article with the following code snippet, taken from WP's(WordPress'es) function image_get_intermediate_size from the file media.php from

   if ( ( $data['width'] == $size[0] && $data['height'] <= $size[1] ) || ( $data['height'] == $size[1] && $data['width'] <= $size[0] ) ) {
   $file = $data['file'];
    list($width, $height) = image_constrain_size_for_editor( $data['width'], $data['height'], $size );
    return compact( 'file', 'width', 'height' );
   }

Well, what's wrong with that statement? there is nothing wrong with that statement, it is just that when you have an original image size which width or height was the same as the default thumbnail size, since the autogenerated thumbnail width is always lesser than the original image, then the 'autogenerated' thumbnail size will always be returned

Consider the following example, you have your original image at the resolution of 200px * 135px.
Note that the default thumbnail size generated by WP is 150px * 135px, and then you have the following code which is intended to show the featured image for the current page:

<?php echo get_the_post_thumbnail($page->ID, array(200, 135)); ?>

You will not get your 200px * 135px as you intended, instead the code will give you a 150px * 135px thumbnail size, since the later rule from the if stament presented earlier fits to these sizes perfectly, it will gives you a cropped and scaled image of 150px * 135px

A fast fix would be specifying get_the_post_thumbnail($page->ID, array(200, 136)) which will give you a 'slightly distorted' thumbnail, another fix would be implementing a default thumbnail size via WP's function set_post_thumbnail_size on your theme's function.php file

Kamis, 17 Januari 2013

[YII] Quick Start, YII Tutorial in 2 minutes!

Yii as simple as 1..2..3 For this tutorial, i assume that you are working in windows environtment and already setup your local webserver (xampp, wamp, etc..)
  1. Download Yii anywhere you wanted, extract them to any folder you wanted.., for this example let's say after you download the zip file, you extract it to c:\yii
  2. Open up command prompt / terminal
  3. Change your dir to the directory where you put your php.exe, in my case it is in C:\xampp\php
  4. On that dir, execute the command:
    php "C:\yii\framework\yiic" webapp MyAppName
  5. Now move the folder MyAppName to your htdocs folder,
    in my case i move entire folder to C:\xampp\htdocs
  6. That is it.. now you have a fully working MVC Yii application
    Open your browser and then go to the address http://localhost/MyAppName

Selasa, 04 September 2012

Win7 XAMPP, port 80 problem. Could not start xampp

I could not start xampp on my computer, i think i need to put the findings here. Just in case i need them again, or someone else having the same problem as i had
  1. Open your comand prompt and type netstat -ano
  2. Search for the line which is listening to port 80, note the PID
  3. If the PID is not 4 then you may have the solution right away. Go back to command and type tasklist
  4. Search for the PID, if it's Skype, you need to change the port by using the advanced configuration panel, if any other program, re-check if you need the program, if you don't need it, you may simply do a taskkill -pid [pid]
  5. You may restart your xampp now.
  6. Other area you might want to check :
    - Disable IIS Service: World Wide Web Publishing
    - Disable BranchCache Service
    - SQL Server 2008 R2, turn of the Error Reporting Feature
  7. If the PID mentioned earlier was 4, as the last resort you might want to do the following
    - Open Device Manager
    - View » Show hidden devices
    - Under the tree-view, Expand Non - Plug and Play Drivers
    - Search for HTTP and then disable it
    - Do a reboot
    **If you have trouble with printer spooling after this steps, you might want to change the default port by modifying the httpd.conf file and change the port 80 to something more unique to yourself , but after you change the port, say for example port 98 you need to access the local site using this : "http://localhost:98"
Update:
another way to try which one is using the port 80, use telnet
  1. If telnet client is not installed, install it by opening cmd prompt and then run it as administrator then type "optionalfeatures" without the quotes, and then find telnet client and then install it.
  2. Run telnet 
  3. open host: o 127.0.0.1 80
  4. type : GET
  5. read the information there

Good luck All!! :)

Selasa, 26 Juni 2012

Some Library to ease your web-app development

I read some website, and i think i'm going to make my own note here, hope someone or someday we will find this usefull. This is a list of 'commonly' used javascript library when developing business application
  1. jQuery
    Yep.. the famous jQuery.. hhe
  2. jQuery treeTable plugin
    A plugin which will render a tree-like table, table rows which have child for them.. that's a tree-table
  3. jQuery contextMenu
    Just do a "right click", and there you have it, a customized contextMenu for your web app
  4. BeutyTips
    The name says it all.. i guess..
  5. Editable and AutoComplete
    Editable : any area of your web page is editable by clicking them. AutoComplete : FB/twitter like auto complete when you tag your friend
  6. Color Picker
  7. jQuery numberFormatter
    Entering the edit box makes the number goes normal, and leaving the edit box makes the number pretty.. 60000 => 60,000
  8. iScroll
    IOS like scrolling? hmm eye candy..
  9. Mustache
    Template-ing by using Javascript
  10. Quicksand
    Another eye candy.. i think iOS made some revolution here!! Shuffling ordering the divs!
  11. JQGRID
    Yep.. the mighty grid we all see everyday on our business application
  12. Hotkeys
    If you are here.. you should press cntrl-d (bookmark cubei pleaseee.. hhe)
  13. jsTree
  14. Raphael
    Small but powerful library to help you working with your vector drawings
  15. gRaphael
    do you need some chart? :)
That's it guys.. now go and invent an app! :D
c ya and God Bless!

Minggu, 06 November 2011

ubuntu: Installing php apache mysql

Steps to install the webserver to your ubuntu ;)
  1. sudo apt-get install apache2
  2. sudo apt-get install mysql-server
  3. sudo apt-get install php5-mysql
  4. sudo /etc/init.d/apache2
  5. gksudo gedit /etc/apache2/httpd.conf
    insert this line(without the quotes) : "ServerName localhost"
  6. sudo apt-get install phpmyadmin
  7. If you do not specify password for your mysql installation, you need to modify the phpmyadmin config file. open gedit and edit the phpmyadmin configuration file "/etc/phpmyadmin/config.inc.php" and uncomment those line similar to this one :
    $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
Testing :
open firefox and type this address : http://localhost/phpmyadmin

Well done and congratulation, you basic server (local) configuration is ready! ;)

basic information :
your local website storage located in "/var/www" if you would like to configure for other location, you should do it within the apache virtual hosts.. and that's another topics i will try to cover next time..