Convert Image And Save To Disk


Aug 14, 2007

I am writing a small script to convert from .jpg to .gif

$filename = $_GET['file']; // always .jpg
$type = $_GET['type'];

$im = @imagecreatefromjpeg($filename);
if ($im === false)
{
die('Unable to open image');
}
if ($type == "gif")
{
header ('Content-Type: image/gif');
imagegif($im);
imagedestroy($im);
}

This script displays the image on the browser page, whereas I would like to actually have a variable pointing to the relative path, ie. $location = "http://www.xx.com/uploads/image.gif" Any suggestions? I read that imagegif($im,$destination); can be used, but it's giving me errors..

View 1 Replies


ADVERTISEMENT

Save A New Created Image On Disk?

i have created image by mixing logo and the original image. It create image and show in the same window.

I have done 3 steps for this.

First i upload an image to my server by using move_upload_file, then i resize it using class "thumbnail.class.php"

My next step was to embed company logo in it(which i already done) and save new embedded logo image to the path where i first upload the original image i mean i want to overwrite the new created image on the previously uploaded image in my step1.

Here is my code which upload image first, resize it and then create a new embed logo image

include("includes/thumbnail.class.php");
$file_extension=strtolower(get_ext($_FILES['photo_1']['name']));
$photo_1="images/cars/".time().'_1.'.$file_extension;
copy($_FILES['photo_1']['tmp_name'],$photo_1);

[Code]....

View 3 Replies

Save BLOB Image To Disk From Database?

I have stored an image in my database as a BLOB file. This might not be the best practice (I know this). I wanted to create a link on my page when clicked with prompt the user with the typical save file prompt so they can save the file on their personal disk.

I have researched online but what I am trying does't not seem to work it just posts the bytes to my page and not in a file. My code to save the file is below. I am using a framework so the DB transaction and retrevial code might look strange but the values are being set properly. The files were also encoded in base64 before being stored in the DB so I call the decode function to return it to its normal state.

function save_file($file_id) {
$result = $DB->get_file($file_id);
$size = $result->fields['size']; //1024
$mime = $result->fields['mime']; //image/jpg
$name = $result->fields['name']; //test.jpg
header("Content-Disposition:attachment;filename=".$name);
header("Content-Type=: ".$mime);

[Code]...

View 2 Replies

How To Save Blob Data To Hard Disk?

I have stored my document files in a blob field (mysql)I know how to allow users to download the file manually one by one But I want to loop through the whole table and export the blob data as files and store it in hard disk.

View 4 Replies

Save An Inbound E-mail Attachments To Disk

I am looking to write a PHP script that I can pipe an email too. The script then extracts all attachments and saves them to a folder on the server, discarding the message.

I have found many examples to read the email as a string which can be split up:

$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd)) {
$email .= fread($fd, 1024);
}
fclose($fd);

However non of these handle the extraction of mime attachments. I have had a look at the PHP Manual but with no luck on seeing how to slot it all together.

Is there an easy way to do this, it is even possible using pipes rather than a pop account?

View 1 Replies

Parsing Xml Document And To Save Doc's On Local Disk

I want to parse xml document which is on my server and I want to parse this articles inside tags to download on my local computer disk (not the server disk).

<pdf>PHP_Anthology.pdf </pdf> <pdf>PHP_AnthologyVolumeII.pdf </pdf>
<pdf>Linux.pdf </pdf>
<pdf>...</pdf>

View 3 Replies

Save Html-forms Data To Local Disk?

A question on html-forms:

We have an application where users will get a CD with,
among other things, some html-forms for them to fill in.
When they click the submit-button, the data is transferred
to a webserver php-script that will then process the info.
The forms-definition looks something like this:

<form action="http://www.ourdomain.com/receiver.php" method="post">
<p>Question 1:
<p><textarea name="reply01" cols="40" rows="5"></textarea>
<p>Question 2:
<p><textarea name="reply02" cols="40" rows="5"></textarea>
<p>Question 3:
<p><textarea name="reply03" cols="40" rows="5"></textarea>
... etc ...
<p><input type="submit" value="Submit answers!">
</form>

Now, my concern is (since there might be quite a lot of data filled in),
if e.g. the internet-connection for some reason is broken
at the moment when the user clicks the submit-button,
there is a risk they will lose all the text and would have to re-type it,
which I would like to avoid, of course.

How can I best solve this issue?

Ideally, I would like to store the info on their local C: drive
before submitting, and automatically retrieve the text if they
later return to the page, but I guess that's not possible from
an html doc, right?

If so, any other suggestions how to resolve this issue?

View 5 Replies

Save Imgares From Access Database To Hard Disk Automatically?

In access DB we have more then 1000 images saved as clob. I can read this clob by php but i do not know if i can automaticaly save files to disk. Is this possible to save all 1000 files to disk from DB?

View 1 Replies

Disable Download Image To Disk

Could someone please direct me to a way to preventing people from downloading images from my website.

View 5 Replies

Saving(writing) Image To Disk

I have an image that i want to rotate. After rotating it, i want to save(write) it back to my disk. Code:

View 1 Replies

Render An Image Without Saving It To Disk Using PHP GD Libs?

have the following function

function renderBusinessCard($details){
//Getting the template for the business card
$filename = Templates::model()->getTemplateFileName($details['BusinessCards']['dp_id']);

[Code]....

What I want to achieve is to display the image within an image tag like the following

<img src="<?php renderBusinessCard($details); ?>"

but somehow it's always rendering garbled code to the screen and not the result I want. Is this at all possible? And how without using a seperate file, I want this to remain within a function or method.

View 2 Replies

Display Image Read From Local Disk?

My problem stems from reading an image from the local disk and displaying it. There's a middle step of storing it in a database, but I simplified the problem into this test script that replicates the error:

The image "http://example.com/test.php" cannot be displayed, because it contains errors.

test.php looks like this:

$location='/location/to/image.gif';
$size = getimagesize($location);
$img_type = $size['mime'];
$data = file_get_contents($location);
$img_data = addslashes($data);
header("Content-type: ".$img_type);
print $img_data;

A print_r of $size gives me valid information (e.g., $size['mime'] is "images/gif") so this shouldn't be a permissions problem.

I am using examples from online of uploaded images instead of images grabbed locally.

View 3 Replies

Function That Return A Small Image Without First Writing To Disk

I have a large number of images. Is there a function that
return a small image without first writing to disk. I want to minimize the
number of files I have on my disk. This is for intenrnal application that I
want to develop. It will be accessed through local area network.

View 2 Replies

CodeIgniter :: Resize And Watermark Image Without Saving It To Hard Disk?

I'm having a problem: I want to resize and watermark an image in CodeIgniter. But I need "dynamic_output" to be TRUE.

$this->image_lib->resize();
$this->image_lib->watermark();

But when resize function fires it returns the image directly.I don't need to save the image to save temporary copy.

View 1 Replies

Getting Server CPU Usage, Memory Left And Disk Space Left On Disk

I'm trying to detect when the memory on my server becomes to low, the cpu usage when it gets to high and when the disk space left on my server gets to low. Does anyone know how to do that with php?

View 2 Replies

Wordpress Image Upload "failed To Write To Disk"?

Wordpress image upload has worked well for months. Suddenly, I get "failed to write file to disk" though nothing has changed. Read the wp forums and worked with my hosting co to do the following:

Checked the php.ini file to read: upload_tmp_dir="/tmp"

Changed "/tmp" to be a tmp folder inside wp-content/images

permissions set to 777

restarted database

What else can I do? My host co can't or won't help further since it's my own installation of wp (2.5.1). My site is on a shared linux server. Anything else I can add?

View 2 Replies

Save The Original Image In The Site Images/full - Create A Proportional Image Thumbnail?

I am looking to create a script in php that will get an image from an upload form and upload it to a site using ftp.It needs to save the original image in the site images/full/ and also create a proportional image thumbnail (100x100) in images/thumb/What is the simplest way to go about this?

EDIT: Oh just to mention i need to create a script, not use a web app

View 1 Replies

Disable Right-click Image Save As Or Mask / Replace Image Name?

I'm creating a simple facial recognition script. It will show the pictures of other users and the person taking the test will have to pick each person's name from a drop-down next to each picture.

It's just for fun and I don't have to be utterly obsessive about security (ie. I won't try to disable view source code) BUT a very simple cheat would be to right-click the image: most users will figure out from the picture name who the picture is.

Is there a simple way to simply not allow a person to right click on ANY image shown on a page? If there is not, is there a way to put some bogus name in the "save image as" name box?

View 6 Replies

Upload The Image Save It To The Image Folder In Htdocs Directory?

when users upload the image i save it to the image folder in htdocs directory. so any user without logging into site can go type the url/images/"name" would get it. what is the best way to prevent this. since the browse would just request just like the user typing directly in the address bar the location of the image.I was thinking of using a script to download each image file from a directory after checking the session details. Do you think will it will a good approach if so can you suggest me a script.I don't want to use database. I think it will be slow. OR if it is the better approach let me know.

View 6 Replies

String - Turning Text Into Image - GD - Save Image

I'm using this script to simply create an image from text. What I would like to know is how to save the image instead of printing straight to browser;

// an email address in a string
$string = $post[$key];
// some variables to set
$font = 4;
$width = ImageFontWidth($font) * strlen($string);
$height = ImageFontHeight($font);

[Code]...

View 3 Replies

Convert Words And Save Into File

I am novice in PHP, I read book and try to write some PHP code, but I don't have success in that my attempt. I think that this what I work isn't hard, but I don't know to do. I need to create in PHP some code which will:

1. In text field I enter some words in 2-3 rows, example

word11 word12 word13
word21 word22 word23
word31 word32 word33

and click to button Convert,

2. After click on that button php script will take that words and convert into this mode:

word11-word12-word13(TAB here without space)word11 word12 word23
word21-word22-word23(TAB here without space)word21 word22 word23
word31-word32-word33(TAB here without space)word31 word32 word33

(spaces between words will convert into - and between first and second mode with TAB)

3. On that way converted text to be saved into new file which will be with name of first line "word11 word12 word13".

View 1 Replies

Save The PDF On A Server, And Convert The PDF To JPG For Viewing Online?

I have a CMS where the client can upload web images, JPG, JPEG, and GIF. But the client wants to upload large PDF's for his clients to download.My question is, can I upload a PDF, save the PDF on a server, and convert the PDF to JPG for viewing online.

I've tried to manipulate the CMS to accept PDF's, but when I download them, they don't look right.

View 13 Replies

Save Image After Some Data Written On That Image?

i am displaying an image in a div and content in another div.using jquery draggable method, i placed the content in that div on the image. Now i want to save that image with content as an image.

View 1 Replies

Write Over An Existing Image Then Save It As A New Image.

I would like to offer a service to my members where they can select an image and their name and a script will generate a forum signature for them, basically i need to be able to write over an existing image then save it as a new image.

View 1 Replies

Create Code Which Convert Words And Save Into File?

I am novice in PHP, I read book and try to write some PHP code, but I don't have success in that my attempt. I think that this what I work isn't hard, but I don't know to do.

I need to create in PHP some code which will:

1. In text field I enter some words in 2-3 rows, example

word11 word12 word13
word21 word22 word23
word31 word32 word33
and click to button Convert,

2. After click on that button php script will take that words and convert into this mode:

word11-word12-word13(TAB here without space)word11 word12 word23
word21-word22-word23(TAB here without space)word21 word22 word23
word31-word32-word33(TAB here without space)word31 word32 word33

(spaces between words will convert into - and between first and second mode with TAB)

3. On that way converted text to be saved into new file which will be with name of first line "word11 word12 word13".

View 3 Replies

Convert A Large String Of Base 64 Image Data Back To An Image?

I have a large string of base64 image data (about 200K). When I try to convert that data by outputting the decoded data with the correct header, the script dies, as if there isn't enough memory. I get no error in my Apache logs. The example code I have below works with small images. How can I decode a large image?

<?php
// function to display the image
function display_img($imgcode,$type) {
[code]....

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved