| 
	
 | 
 Posted by -Lost on 06/04/07 15:42 
-Lost wrote: 
> ZeldorBlat wrote: 
>> Pretty pointless and really not that difficult, either: 
>> 
>> function imageToHTML($img) { 
>>     $width = imagesx($img); 
>>     $height = imagesy($img); 
>> 
>>     for($i = 0; $i < $height; $i++) { 
>>         for($j = 0; $j < $width; $j++) { 
>>             $color = str_pad(base_convert(imagecolorat($img, $j, $i), 
>> 10, 16), 6, '0', STR_PAD_LEFT); 
>>             echo '<div style="position: absolute; background-color: 
>> #' . $color . '; height: 1px; width: 1px; top: ' . $i . 'px; left: ' . 
>> $j . 'px;"></div>' . "\n"; 
>>         } 
>>     } 
>> } 
>  
> Would that function be limited to an instance where an image was created  
> or is it possible to use imagecreatefrompng()? 
>  
> Granted, I know very little about image-related PHP.  I thought I could  
> plug in a PNG I had (just to get a valid image resource) and I did  
> nothing, but crash my browser *every* time. 
 
I played with it a bit more and I see now that it merely sent too much  
information to the browser.  I had a fairly small image (300x30) and it  
sent almost 10,000 lines of DIVs to the client-side. 
 
Anyway, now that I see it works.  How come it does not display the  
images correctly? 
 
If I look close I can see my image amongst a predominantly black square. 
 
--  
-Lost 
Remove the extra words to reply by e-mail.  Don't e-mail me.  I am  
kidding.  No I am not.
 
  
Navigation:
[Reply to this message] 
 |