Stenno
Oct 7 2007, 05:21 PM
Hey fellow coders, I'm having a problem. If you output a im indentifier in php with gd libary. With this method for example: CODE <? header("(anti-spam-(anti-spam-(anti-spam-content-type:))) image/png");
$imgWidth = 50; $imgHeight = 50;
$image=imagecreate($imgWidth, $imgHeight); $colorBlack = imagecolorallocate($image, 0, 0, 0); // first color you define with colorallocate is also the color of the background of your image
imagepng ($image); imagedestroy ($image);
// This gives you a page with a black image of 50x50 pixels. ?> If i look at the source code of that page, i see: QUOTE �JFIF�������;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 70 �C�
#%$""!&+7/&)4)!"0A149;>>>%.DIC<H7=>;�C
;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;��n�"������������ ����}�!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz �������� ���w�!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ���?�( ( I get something similair to that. Now my question: How can i get back the image indentifier (the var $image in the sample code above), with only this weird code ?? Thanks very much in advance, Though i fear not many people here know how this can be done  [size="3"][/size]
Reply
truefusion
Oct 7 2007, 07:35 PM
Replace the first instance of the image variable with CODE $image = @imagecreate($imgWidth, $imgHeight); Then check the page out again.
Reply
Stenno
Oct 7 2007, 08:01 PM
Ohw sorry, thanks for warning. But that's not my question. It's just a quick sample script to explain my question better. Please read it carefully: i would like to know how i can recreate an image with only the weird data (in the quotes).
Reply
truefusion
Oct 8 2007, 12:02 AM
The weird data should be the image itself, it's like opening up an image in an ascii editor. Check out these functions: imagecreatefrompng, imagecreatefromjpeg, imagecreatefromgif, etc..
Reply
Stenno
Oct 8 2007, 05:20 AM
QUOTE imagecreatefromjpeg Create a new image from file or URL And i don't have a file, i only have a string with those weird chars. Or maybe there is some function to create a file first and then use imagecreatefromjpeg() ??
Reply
jlhaslip
Oct 8 2007, 05:31 AM
Sten, Maybe simply tell us exactly what you are trying to do here. You appear to be writing a script to dynamically create an image. And now you want to save it? Why? Just use the script when you need the image... If you really need to save a copy of the actual Image, run that script in your Browser and do a rt-click, save image as... to save it to your desktop. That's the beauty of the script, you don't need to save the image
Reply
rvalkass
Oct 8 2007, 05:56 AM
QUOTE(Stenno @ Oct 7 2007, 06:21 PM)  Now my question: How can i get back the image indentifier (the var $image in the sample code above), with only this weird code ?? Put simply, I don't think you can. What you are asking to do is something similar to opening a binary file in a text editor, saving it, then trying to run it as a binary file - it just can't be done. For example, if you open the TuxKart binary in Kate, you get something like the following repeated for 8000 lines: CODE ELF ��4 d� 4 ( 4 4�4� 4 4�4� � �E� E� � p p\ �, � ȘȘ H H�H� P�td� ����<B <B Q�td /lib/ld-linux.so.2 GNU � _ ( � � ) > � � G ( � � � 5 � � � � � � : / 6 � i � 2 � e - � � � ] p u j : � � � � � There is absolutely no way to turn that back into the binary to be able to use it again. This is pretty much what you are asking to do with your image. Perhaps if you explained why you need to convert the 'code' back into the variable, we might be able to give you a different method.
Reply
Stenno
Oct 9 2007, 02:33 PM
I already found the method to retrieve an image indentifier with only the weird code. It's like this: CODE <? $data = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABl' . 'BMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDr' . 'EX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r' . '8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg=='; //$data is the base64_encoded weird data
$data = base64_decode($data);
$im = imagecreatefromstring($data); if ($im !== false) { header('(anti-spam-content-type:) image/png'); imagepng($im); } else { echo 'An error occurred.'; } ?> Thanks for your help though, and sorry for the weird explenation
Reply
Similar Topics
Keywords : image indentifier gd library gd library- Image Upload
- ?!? (11)
- Watermark Your Image With Simple Php Script
- found it on the net (33)
This script was found on the net http://tips-scripts.com/?tip=watermark#tip B&T's Tips &
Scripts site. Just in case the site may not show, I will include the code here: List of things
needed: 1. your image in any format 2. watermark image--in gif format with transparent background 3.
script below with name (i.e. watermark.php) CODE <?php // this script creates a watermarked
image from an image file - can be a .jpg .gif or .png file // where watermark.gif is a mostly
transparent gif image with the watermark - goes in the same directory as this script // ...
Library Script
- Where? (6)
Hello, everyone. Anyone knows where I can get a library script that acts like CMS script software,
you can add books or delete them. I want to build virtual online library which can be accessible to
everyone. Or just give me some advices how to make it build. I'm a novice in programming....
Dynamic Image / Signature Generator
- a simple code to change text on an image (12)
In search of dynamically changing quote, saying or all other types of text on an image I came across
a code that I have modified to fit my initial usage. This procedure requires two files and short
knowledge of PHP. If you are familiar with Trap17's sig rotation code you will understand this
procedure very fast. Code 1: dynamic_sig.php (you can rename this to index.php and you'll see
at the end why) Code 2: a simple text file named anything (I will call it name.txt ) Code 1
CODE <?php header("Content-type: image/png"); ...
Php And Flash Image Gallery
- Need some help in creating or editing an xml file while viewing some o (5)
Hello there and thanks for the helping hand you are offering. PHP newbie here! /ph34r.gif"
style="vertical-align:middle" emoid=":ph34r:" border="0" alt="ph34r.gif" /> So here is my problem:
On my website I have a flash image gallery.The way the gallery works is by uploading pictures in a
folder and editing? an xml file.(pics.xml) where it adds the following code when you upload a
picture: CODE <pictures> <image location="nameofpicture1.jpg"
desc="" /> <image location="nameofpicture2.jpg" desc="" /...
Trap17 Board Status Dynamic Image
- (13)
I was really board a few days ago and decided to make a trap17 board status image for my sig
/tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> That is the
current beta. I'm still working on it so that it might display the most recent post or
somthing, i'm not sure. After I finish it ill give out the source code but if you want one
right now you can pm me and ill set one up to get the info on your account ^.^ So I was wondering
how you members liked it? You'll probably think that its a waist of time, but alas as I sai...
Flipping An Animated Gif Image W/ Gd Library
- Help (1)
I need an animated gif image flipped using GD library in PHP. I wrote a script to flip still
images, but it doesn't work on animated images. This is probably because I have the script
moving 1 column of pixels at a time, and switching them around. How would I make multiple frames?
Any help would be great! Thanks!...
Detect Image Resolution Without Gd
- Also stop error if not found (1)
Hi, I have come accross some starnge problem in PHP. I wanted to detect the image resolution in
of a URL specified by the user. This is possible via getimagesize() function of PHP that is
independent of GD library. But this function generates a E_WARNING Error if the image is not there.
What shall i do to stop this warning ?? I dont want to show the Error in PHP style but my style of
error reporting. Please help me....
Looking For Php Script : Image Thumbnail Like Imageshack.
- (2)
Does anyone know a code like the one ImageShack uses, like this one. That would be just
awesome, I hate doing it by hand, such a hassal. Until I can find a code similar to that, I think I
will just use ImageShack....
Image Galleres
- (10)
what is a really good image gallery i can hook up for my phpnuke site?? something easy to set up to.
thanks...
Php Photo And Image Gallery Script
- PHP Photo And Image Gallery Script (2)
This script is great and the documentation is excellent!! I have used it on my site without
really knowing much about PHP. Script ...
Image Upload And File Size
- (2)
Hi, I'm trying to upload rather large jpgs files (2560x1920 and ~ 2 megs in size) to my server
via PHP. The problem I am having is that when I upload and attempt to resize by creating a new
image, the new image is always black. Code I'm using is: PHP Code: CODE if(
!empty($thefile_name) ) {
$query = "INSERT INTO coldwell_images
(imagename) VALUES ('insertimage')"; $result ...
I Need A Php Editor
- I need that for image editing (1)
I need a php editor whichc can be used for the image editing like FrontPage for HTML. Can any body
give a link for that...
Write Random Text To Image
- PHP script help! (5)
I'm trying to create a script that writes text to an image. CODE
header("Content-type: image/png"); $_phrases = array( "Test 1",
"Test 2", "Test 3", "Test 4", "etc." ); $_rand_phrase =
$_phrases[rand(0,count($_phrases)-1)]; $_image =
imagecreatefrompng("gmail.png"); $_user_width =
imaagettfbbox(9,0,"tahoma.ttf",$_rand_phrase); $_x_value =
(200-($user_width[2] + 113)); ...
Using The Image Editing Functions Of Php
- Specifically, lines or regular polygons. (4)
I've been experimenting a little with PHP's image functions and I was trying to see if I
could make something that looked 3D, so I started with a cube because it's simple. To make an
isometric picture of a cube, you need to start with a regular hexagon. However, making a regular
hexagon isn't the easiest thing. Is there a function to create a regular polygon, or specify an
angle and magnitude for a vector?...
Need Help Generating Flash Movie With Ming Library
- Please? (0)
I am doing a school project and the guy I am doing it with want some animations. Since gif
animations are not supported by php (patent trouble) I had to make a flash movie. I allready have
the basic code and stuff but the images I try to import in my flash movie don't show. I am
trying to use a gameboard as background for the movie. After the TODO comment I am going to edit the
image so I get an animation, but first things first so this is my code: CODE <?php
//invoer: //array met posities van de huizen $huis //array met posities van de hotels ...
Image/scrolling Menu Correlation
- Help.... plz... (0)
Hey Guyz... I'm working on re-designing my website, and I need a way to set-up my affiliates
page. I have several (decent looking, not that it matters) images for my possible affiliates to
choose from. I currently have this code in effect... CODE <html> <p
align=center>Two different sized advertisments are currently available for ad-exchanges.
Purchasing advertising is currently unavailable. Here are your ad-choices.<select multiple
name="images" size=5><option>88x31 pixel box<option>120x240 pixel
tower</select...
Looking for image, indentifier, gd, library, gd, library
|
|
Searching Video's for image, indentifier, gd, library, gd, library
|
advertisement
|
|