Busy this days
General No Comments »Unfortunately, I was very busy last few days and I couldn’t write something in my blog. I will be busy until the end of this week and then I can come with new stuff to write about.
Unfortunately, I was very busy last few days and I couldn’t write something in my blog. I will be busy until the end of this week and then I can come with new stuff to write about.
I searched on Google for a code example of how to upload and resize an image using CakePHP and I didn't get to much results on this, so I decided to make it on my own way. First of all I created the /foto/ directory in the webroot (app/webroot) and inside it other 2 directories, one for the uploaded image /big/ (this is the big version of the image) and one for the image that will be resized /small/ (this can be the thumbnail), be sure that they have write permissions.
Now create a component called image.php and inside it you will have the code that will handle getting the file extension and resizing the uploaded image (app/controllers/components/image.php):
Now let's see the view that will show the input type file element and the form (app/views/controller_name/upload.thtml):
At the end comes the last part and the "hardest", when comes to write the controller code (app/controllers/images_controller.php):
This is all.
This script above need to have GD installed on the server.
SWFIR (swf Image Replacement), it is a great way to add some style to images inside a web page escaping from the limitations imposed by the HTML but respecting the standard design concepts. This is done using JavaScript and Flash. Using swfir is simple and you don't need any advanced knowledge about Flash or JavaScript. Just download the swfir_v1.zip and unzip it, then upload the 2 files (swfir.js and swfir.swf) from it to the same directory in your website. To make it work all you need to do is include the JavaScript file and then to choose the images that will be styled and features applied to them.
The .js file need to be included in the "head" of the document:
I will use some styling features to the following image:
To call swfIR at work you have to use something like:
The code above need to be situated inside the "body" section. I used some parameters (there are more that can be used/tested) to style my "pic2" image.
The result is something like this:

It works fine in Firefox 2.0 and IE 6.0, unfortunately on some cumputers with SP2 failed to run in IE 6.0, nut sure why but you can write to the SWFIR team.
I see some errors in my blog caused by the code inserted in some examples, I have to find a way to fix this, maybe using a wordpress plugin to deal with the "plain text" code. Also it will help visitors to distinguish easier the post's text from the code examples.
In this post a I will show an example of a simple contact form which sends an email to a specified address, done using CakePHP.
The form has 3 fields: name, email address and message.
Firs of all let's see the "view" for the form displaying. It looks like this (app/views/controller_name/contact.thtml):
Now we need a small component to verify the email address to be a valid one and also to contain the code necessary for the email sending. The component (app/controllers/components/email.php) is looking like this:
And now becomes the logic part, the controller (app/controllers/controller_name.php):
One of the most “productive” way to attract visitors to your website / webblog relying on your content is to use a technique called linkbaiting.
Everything you need to do, to be able to use this feature, is to ensure that you wrote a good (unique) content on your website, a content that people will like and their attention will be caught in such manner that they will post a link towards your website.
This content you have is also called a possible “hook” for the visitor that will point a link to you. Through time there were some attempts to categorize this “hooks”, most encountered are:
- Informational Hooks – described as a content full with good information that can be usefull
- News Hooks – content related with fresh informations about some domains
- Hummor Hooks – funny content including jokes, pictures, movies
- Evil Hooks – means writing some bad things about a well known product / blogger / website, that sometimes can attract a lot of audience.
- Tool Hooks – creating a useful online tool that people will link to it.
Recent Comments