Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Monday, December 9, 2024
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  Is there a way to display pictures in myphpedit?

phpMyEdit Features     Is there a way to display pictures in myphpedit?
Post new topic   Reply to topic   Goto page 1, 2, 3 ... 10, 11, 12  Next  
 
smokinpuppy     Joined: 26 Mar 2012   Posts: 14  
Post Posted: 2012-03-28 19:29
Back to top  Reply with quote     

Hi,

I know its not a good idea to use blobs in mysql so now im saving a path in mysql table but im wondering if there is a away to have phpMyEdit show the image from the server in the table using the path instead of the actual binary data?

Thank you in advance,

Robert

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2012-03-29 15:24
Back to top  Reply with quote     

No image handling functions are built into phpMyEdit.

From an ancient project, I used this schema to save image details including the image type.

Code:
CREATE TABLE IF NOT EXISTS `vs_inventory1` (
  `id` mediumint(6) unsigned NOT NULL AUTO_INCREMENT,
  `item_name` varchar(255) NOT NULL DEFAULT '',
  `item_category` varchar(25) NOT NULL DEFAULT '',
  `catid` smallint(5) unsigned NOT NULL DEFAULT '0',
  `item_sub_cat` varchar(25) NOT NULL DEFAULT '',
  `scatid` smallint(5) unsigned NOT NULL DEFAULT '0',
  `item_number` varchar(20) NOT NULL DEFAULT '',
  `item_description` text NOT NULL,
  `on0` varchar(25) NOT NULL DEFAULT '',
  `os0` varchar(255) NOT NULL DEFAULT '',
  `on1` varchar(25) NOT NULL DEFAULT '',
  `os1` varchar(255) NOT NULL DEFAULT '',
  `amount` float(10,2) NOT NULL DEFAULT '0.00',
  `weight` float(8,2) unsigned NOT NULL DEFAULT '0.00',
  `shipping1` float(8,2) NOT NULL DEFAULT '0.00',
  `shipping2` float(8,2) NOT NULL DEFAULT '0.00',
  `tax` float(6,2) NOT NULL DEFAULT '0.00',
  `taxable` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `addx` smallint(5) unsigned NOT NULL DEFAULT '1',
  `currency_code` varchar(8) NOT NULL DEFAULT 'USD',
  `image` mediumblob NOT NULL,
  `image_width` smallint(5) unsigned NOT NULL DEFAULT '0',
  `image_height` smallint(5) unsigned NOT NULL DEFAULT '0',
  `image_type1` tinyint(2) unsigned NOT NULL DEFAULT '0',
  `image_type2` varchar(20) NOT NULL DEFAULT '',
  `img_attrib` varchar(30) NOT NULL DEFAULT '',
  `hidden` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `last_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `item_number_2` (`item_number`),
  KEY `catid` (`catid`),
  KEY `scatid` (`scatid`),
  KEY `item_name` (`item_name`)
) ENGINE=MyISAM;


A regular PHP script was used to grab the image:
Code:

<?php

// getimage.php

$id = array_key_exists('id', @$_GET) ? @$_GET['id'] : '';

if(is_numeric($id)){

   $data = '';

   $type = '';

   // add your database connection here

   $res  = @mysql_query('SELECT image, image_type2 FROM vs_inventory1 WHERE id = '.$id);

   $data = @mysql_result($res, 0, 'image');

   $type = @mysql_result($res, 0, 'image_type2');

   @header("Content-type: $type");

   echo $data;

}

?>


The PHP/HTML code used to fetch the image is:

Code:
<img src="getimage.php?id=<?php echo $id; ?>" alt="<?php echo htmlspecialchars($item_name); ?>" border="0" <?php echo $img_attrib; ?>>


Storing images in MySQL is (IMHO) a huge waste of time, very inefficient, especially if recalling more than one image on a page due to multiple db connections having to be made.

http://www.hockinson.com/photo-gallery-example/

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2012-03-29 15:30
Back to top  Reply with quote     

Search the forum for CONCAT

With path information stored in the db, examples can be found for creating custom HTML tags for A tags, IMG tags, etc., using the MySQL CONCAT function.

Code:
$opts['fdd']['dummy2'] = array (
   'name' => 'Thumbnail',
   'sql|VLF' => 'if(category = "other",
      CONCAT("<a href=\"", dir, "/", filename, "\" target=\"_blank\">link</a>"),
         if(category = "thumb", CONCAT("<a rel=\"example_group\" href=\"", REPLACE(dir, "/tn", "/"), filename, "\" target=\"_blank\"><img src=\"", dir, "/", filename, "\" ", " alt=\"\" border=\"0\"></a><br><a href=\"fancybox.change.php?upld_id=", upld_id, "\">Replace</a>"), ""))',
   'options'  => 'VLF',
   'input'  => 'R',
   'escape' => false,
   'sort'     => false
);


Code:
$opts['fdd']['virtual_field'] = array (
   'name' => 'Thumbnail',
   'sql|VLF' => 'if(mime_type = "image/jpeg", CONCAT("<a rel=\"example_group\" href=\"", REPLACE(dir, "/tn", "/"), filename, "\" title=\"", text_1, "\" target=\"_blank\"><img src=\"", dir, "/", filename, "\" ", " alt=\"\"></a>"), "")',
   'options'  => 'VLF',
   'input'  => 'R',
   'escape' => false,
   'sort'     => false
);


 
smokinpuppy     Joined: 26 Mar 2012   Posts: 14  
Post Posted: 2012-03-30 00:17
Back to top  Reply with quote     

Hi I'm trying to use the path (ex. Pictures/file.jpg) in another column to show the image in the next column in the row like a thumbnail. I tried the Coe before but it didn't work. Also I'm trying to put the picture which is actually in a folder with the phpMyEdit file. Thanks,

Robert

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2012-03-30 05:50
Back to top  Reply with quote     

"Pictures/file.jpg" is data in a database table, right?

 
smokinpuppy     Joined: 26 Mar 2012   Posts: 14  
Post Posted: 2012-03-30 11:18
Back to top  Reply with quote     

Yes, that's right

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2012-03-30 17:30
Back to top  Reply with quote     

Adding one of these to the field array for your_field_name should work, i.e. use the second one (with ../) if the Pictures folder is one directory level above the phpMyEdit script.

Code:
'sql|VLF' => 'if(your_field_name <> "", CONCAT("<img src=\"", your_field_name, "\" ", " alt=\"\">"), "")',

'sql|VLF' => 'if(your_field_name <> "", CONCAT("<img src=\"../", your_field_name, "\" ", " alt=\"\">"), "")',


 
smokinpuppy     Joined: 26 Mar 2012   Posts: 14  
Post Posted: 2012-03-30 18:25
Back to top  Reply with quote     

Thank you very much, it worked, and looks great :)

Just for reference I also added height and border so it would fit nicely in the column. Ended up like this:

'sql|VLF' => 'if(Filename <> "", CONCAT("<img src=\"", Filename, "\" ", " alt=\"\"height=75 border=0>"), "")',

 
felicia112     Joined: 21 Dec 2021   Posts: 2  
Post Posted: 2022-02-11 05:50
Back to top  Reply with quote     

Thank you for writing this piece. I am delighted to have read this article and share it with others? Don't know if you agree? I am a student learning about online games, and I have access to a fantastic gaming website. Slope unblocked is a popular y8 game that features an infinite mode. The game was created by RobKayS, and the music was composed by SynthR. This game has unique 3D graphics that are suitable for players of all ages, especially families and children.

 
khatrimaza     Joined: 30 Apr 2023   Posts: 7  
Post Posted: 2023-04-30 17:04
Back to top  Reply with quote     

khatrimaza one of the best free movie download site that curates movies, independent films, TV shows, and stand-up comedy videos.

 
DAvidjohn456     Joined: 11 Jul 2022   Posts: 33  
Post Posted: 2023-06-01 11:48
Back to top  Reply with quote     

Yes, it is possible to display Infinite Fusion Calculator images in phpMyEdit using the path stored in a MySQL table instead of the actual binary data.

 
NateMeany     Joined: 06 Jun 2021   Posts: 3  
Post Posted: 2023-06-02 12:18
Back to top  Reply with quote     

RedBox TV is perfect for anyone looking for a cost-effective and convenient way to watch their favorite TV shows and movies on the go. So why pay for visit https://eagleviewfirearms.com/ site for get expensive cable or streaming services when you can enjoy high-quality content for free with RedBox TV? Download the app today and start streaming!

 
NateMeany     Joined: 06 Jun 2021   Posts: 3  
Post Posted: 2023-06-09 11:49
Back to top  Reply with quote     

In the example above, replace "path/to/your/image.jpg" with the actual file path or URL of the site https://remedialshrooms.com/ for image you want to display. When this PHP code is executed, it will generate HTML output that includes the image tag, and the specified image will be displayed in the browser.

 
sweetyjain002007     Joined: 12 Jun 2023   Posts: 166  
Post Posted: 2023-06-12 12:55
Back to top  Reply with quote     

Kheda Escorts
Mahisagar Escorts
Mehsana Escorts
Morbi Escorts
Narmada Escorts
Navsari Escorts
Panchmahal Escorts
Patan Escorts
Porbandar Escorts
Rajkot Escorts
Sabarkantha Escorts
Surat Escorts
Surendranagar Escorts
Tapi Escorts
Vadodara Escorts
Valsad Escorts
Ambala Escorts
Bhiwani Escorts
Charkhidadri Escorts
Faridabad Escorts
Fatehabad Escorts
Gurugram Escorts
Hisar Escorts
Jhajjar Escorts
Jind Escorts

 
Zombies     Joined: 12 Dec 2022   Posts: 932  
Post Posted: 2023-06-21 14:41
Back to top  Reply with quote     

Thanks, that was a really cool read! pg slot

 
Post new topic   Reply to topic   Goto page 1, 2, 3 ... 10, 11, 12  Next  

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy